Get Original Url

  • Thread starter Thread starter comphilip
  • Start date Start date
C

comphilip

I make a request with the address:
http://localhost/admin/administrator/new

Tracing the request with fiddler2, the URL of Request-Line of http message
is remain the same: /admin/adminstrator%2fnew.

But the value is change while accessing
HttpContext.Current.Request.Url.ToString(), it becomes
http://localhost/admin/adminstrator/new, "%2f" is automatically being
unescaped to "/". administrator%2fnew is a separated segment, but ASP.NET
make it two segments: administrator and new.

I try several way to get the original url:

HttpContext.Current.Request.Url.OriginalString
HttpContext.Current.Request.RawUrl
HttpContext.Current.Request.ServerVariables["URL"]

all fail.

How can I get the original url without any automatically unescaping?
 
The environment of my computer is:
Windows XP + sp3
..NET 2.0

One more thing. Several months before I developed a similar web site on
vista + iis7 + asp.net 3.5. The url gotten from
HttpContext.Current.Request.Url.ToString() was not unescaped. The
percent-encoding was remained.

I don't ware why there are two different behaviors. Does it rely on IIS or
ASP.NET?
 
Back
Top