lunedì, agosto 29, 2011

Paths and URL Fragments from the HttpRequest Object

Steve Lautenschlager has an awesome article on the properties of the request object. I’m reposting a few of his examples for my own reference, but I highly recommend checking out his article: http://www.cambiaresearch.com/c4/dfdb20ae-b335-48ae-a201-f2a5a8329342/how-do-i-get-paths-and-url-fragments-from-the-httprequest-object.aspx.

 

Examples based on the following URL: http://localhost:96/Cambia3/Temp/Test.aspx?q=item

Request.ApplicationPath: /Cambia3

Request.CurrentExecutionFilePath: /Cambia3/Temp/Test.aspx

Request.FilePath: /Cambia3/Temp/Test.aspx

Request.Path: /Cambia3/Temp/Test.aspx

Request.PhysicalApplicationPath: D:\Inetpub\wwwroot\CambiaWeb\Cambia3\

Request.QueryString: /Cambia3/Temp/Test.aspx?query=arg

Request.Url.AbsolutePath: /Cambia3/Temp/Test.aspx

Request.Url.AbsoluteUri: http://localhost:96/Cambia3/Temp/Test.aspx?query=arg

Request.Url.Host: localhost

Request.Url.Authority: localhost:96

Request.Url.LocalPath: /Cambia3/Temp/Test.aspx

Request.Url.PathAndQuery: /Cambia3/Temp/Test.aspx?query=arg

Request.Url.Port: 96

Request.Url.Query: ?query=arg

Request.Url.Scheme: http

Request.Url.Segments: /

Cambia3/

Temp/

Test.aspx