Request.Url.AbsoluteUri and rewritten URL's
I need to be able to get the URL as I see it in the browser i.e The rewritten one. For instance:
If my Url was www.myurl.com/Test.html
and I then used Requ开发者_开发知识库est.Url.AbsoluteUri
, the URL returned would be: www.myurl.com/Default.aspx?Action=Test
I need to be able to get back the exact rewritten URL.
Does anyone know how I can achieve this?
From Tchami:
Have you tried Request.RawUrl? I think that gives you the unmapped URL.
Will mark this as the answer when I am allowed.
You could rewrite the URL so, that it includes the original URL as a querystring parameter.
For example: url="(.*)" to="http://newurl.com?original=$1".
(Note you'll still have to adjust the regex to work with URLs that contain a querystring.)
精彩评论