开发者

Request.Url.AbsoluteUri and rewritten URL's

开发者 https://www.devze.com 2023-01-10 04:24 出处:网络
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 UR

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.)

0

精彩评论

暂无评论...
验证码 换一张
取 消