URL fragments or parts and get Paths using HttpRequest in C#

URL fragments or parts and get Paths using HttpRequest, If we want URL fragments or parts of the URL we can get that in C# using HttpRequest as like follwoing:

In following example we have used those properties of .Net Framework Library

Below is just example URL that has taken for us to understand:

http://www.example.com:80/Products/Product-name/Detail.aspx/path/info?q=item#classic

as below

HttpRequest path and URL fragments / parts

Request.ApplicationPath: /Products

Request.CurrentExecutionFilePath: /Products/Product-name/Detail.aspx

Request.FilePath: /Products/Product-name/Detail.aspx

Request.Path: /Products/Product-name/Detail.aspx/path/info

Request.PathInfo: /path/info

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

Request.RawUrl: /Products/Product-name/Detail.aspx/path/info?q=item

Request.Url.AbsolutePath: /Products/Product-name/Detail.aspx/path/info

Request.Url.AbsoluteUri: http://www.example.com:80/Products/Product-name/Detail.aspx/path/info?q=item

Request.Url.Classic:

Request.Url.Host: www.example.com

Request.Url.LocalPath: /Products/Product-name/Detail.aspx/path/info

Request.Url.PathAndQuery: /Products/Product-name/Detail.aspx/path/info?q=item

Request.Url.Port: 80

Request.Url.Query: ?q=item

Request.Url.Scheme: http

Request.Url.Segments: /
Products/
Product-name/
Detail.aspx/
path/
info

Those are all the ways to get full, partial, fragments or parts of the URL.

THank you very much for going through this article.

5 comments on “URL fragments or parts and get Paths using HttpRequest in C#”

  1. Gravatar of rolex replica  rolex replica
    Posted Monday, December 3, 2012 at 11:40:55 PM

    Request as like follwoing:

    In following example we have used those properties of .Net Framework Library

  2. Gravatar of replica watches  replica watches
    Posted Wednesday, December 12, 2012 at 7:31:19 AM

    Now i am glad relating to an opportunity to thank you greatly to your style guidebook, it could be nothing to convey the website will be beautiful. you happen to be amazing!

  3. Gravatar of rolex replica  rolex replica
    Posted Wednesday, December 12, 2012 at 10:37:41 AM

    Thanks regarding expressing biography of well-known playback vocalist.

  4. Gravatar of omega replica  omega replica
    Posted Wednesday, December 12, 2012 at 10:27:46 PM

    Thank you for taking the time to share this!

  5. Gravatar of rolex replica  rolex replica
    Posted Monday, May 6, 2013 at 1:45:09 AM

    One particular biggest benefit of deciding on the most beneficial look-alike would it be is actually practically indistinguishable.

Post a comment