Monday, 15 March 2010

Retrieve just a URI’s path

Need to get the path component of a URI without the domain, port, or query string? Use Request.Url.AbsolutePath. Despite its name it returns a relative URL:

So becomes /somepage.aspx.

No comments:

Post a Comment

Spam comments will be deleted

Note: only a member of this blog may post a comment.