How to do it: Get Paths and URL fragments from the HttpRequest object

Description Article
Table of Contents
Summary

This article examines the properties of the Request object that will provide path and url information related to the application and the current request.

Operations
Request 1: http://localhost:8088/Training/Temp/Test.aspx?q=item#fragment
How to do it
Property Contents
Request.ApplicationPath: /Training
Request.CurrentExecutionFilePath: /Training/Temp/Test.aspx
Request.FilePath: /Training/Temp/Test.aspx
Request.Path: /Training/Temp/Test.aspx
Request.PathInfo:
Request.PhysicalApplicationPath: D:\Inetpub\wwwroot\TrainingWeb\Training\
Request.RawUrl: /Training/Temp/Test.aspx?query=arg
Request.Url.AbsolutePath: /Training/Temp/Test.aspx
Request.Url.AbsoluteUri: http://localhost:8088/Training/Temp/Test.aspx?query=arg
Request.Url.Fragment:
Request.Url.Host: localhost
Request.Url.Authority: localhost:8088
Request.Url.LocalPath: /Training/Temp/Test.aspx
Request.Url.PathAndQuery: /Training/Temp/Test.aspx?query=arg
Request.Url.Port: 8088
Request.Url.Query: ?query=arg
Request.Url.Scheme: http
Request.Url.Segments: /
Training/
Temp/
Test.aspx
Request 2: http://localhost:8088/Training/Temp/Test.aspx/path/info?q=item#fragment
How to do it
Property Contents
Request.ApplicationPath: /Training
Request.CurrentExecutionFilePath: /Training/Temp/Test.aspx
Request.FilePath: /Training/Temp/Test.aspx
Request.Path: /Training/Temp/Test.aspx/path/info
Request.PathInfo: /path/info
Request.PhysicalApplicationPath: D:\Inetpub\wwwroot\TrainingWeb\Training\
Request.RawUrl: /Training/Temp/Test.aspx/path/info?query=arg
Request.Url.AbsolutePath: /Training/Temp/Test.aspx/path/info
Request.Url.AbsoluteUri: http://localhost:8088/Training/Temp/Test.aspx/path/info?query=arg
Request.Url.Fragment:
Request.Url.Host: localhost
Request.Url.LocalPath: /Training/Temp/Test.aspx/path/info
Request.Url.PathAndQuery: /Training/Temp/Test.aspx/path/info?query=arg
Request.Url.Port: 8088
Request.Url.Query: ?query=arg
Request.Url.Scheme: http
Request.Url.Segments: /
Training/
Temp/
Test.aspx/
path/
info