Retrieve a URL in asp.net that has been rewritten by using url rewriting tool

Needless to say its simple and easy to retrieve a url before its been rewritten  using  asp.net Request object .This short article explains  how to retrieve a url  after it has been rewritten using  url rewriting technique(isapi  in my paticular case ).

 

Out of the many server variables available to our disposal the Request.ServerVariables("HTTP_X_REWRITE_URL") gives you the rewritten url.

A sample code line would be as follows in vb.net

Dim myUrl As String = Request.ServerVariables("HTTP_X_REWRITE_URL")

That should be all you need to do .Hope that helps

Happy Coding

Cheers!!!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s