Tuesday, 25 September 2012

ASP.NET Web Forms Application Paths Related

This article is going to list all ASP.NET Web Forms application paths related properties and their values on the Request object. Below the test result are based on this scenario: local hosted IIS site named VirtualSite, first we access to http://localhost/VirtualSite/Redirect/dummy.aspx and there is a HttpModule to redirect the request to http://localhost/VirtualSite/Redirect/Redirect.aspx. The request has parameters "a=1&b=2&c=3". So here it is:

Request Property Value
ApplicationPath /VirtualSite
AppRelativeCurrentExecutionFilePath ~/Redirect/Redirect.aspx
CurrentExecutionFilePath /VirtualSite/Redirect/Redirect.aspx
FilePath /VirtualSite/Redirect/Redirect.aspx
Path /VirtualSite/Redirect/Redirect.aspx
QueryString {a=1&b=2&c=3}
RawUrl /VirtualSite/Redirect/Dummy.aspx?a=1&b=2&c=3
Url.AbsolutePath /VirtualSite/Redirect/Redirect.aspx
Url.AbsoluteUrl http://localhost:25739/VitualSite/Redirect/Redirect.aspx?a=1&b=2&c=3
Url.Authority localhost:25739
Url.DnsSafeHost localhost
Url.Host localhost
Url.LocalPath /VitualSite/Redirect/Redirect.aspx
Url.OriginalString http://localhost:25739/VitualSite/Redirect/Redirect.aspx?a=1&b=2&c=3
Url.PathAndQuery /VitualSite/Redirect/Redirect.aspx?a=1&b=2&c=3
Url.Port 25739
Url.Query ?a=1&b=2&c=3
Url.Scheme http

Since there is a redirect, as you can see, only the RawUrl contains the very original request, all other values are for the redirected Url, event the Request.Url.OriginalString

No comments: