How2 capture the current URL and its QueryString?

  • Thread starter Thread starter clintonG
  • Start date Start date
// This will do...
Page.Title = this.Page.Request.Url.AbsoluteUri;

<%= Clinton Gallagher
 
lOn Fri, 12 May 2006 11:22:58 -0600, "clintonG"
// The ServerVariables collection can help me build this:
http://xp1/METRO2/HomePage.aspx

// URL & QueryString generated by the 2.0 Login control click event.
// What I need to capture is this...
http://xp1/METRO2/Membership/Login.aspx?ReturnUrl=/METRO2/HomePage.aspx

Comments?

Have you looked at the HttpRequest object.

Can be obtained via:

1) Page.Request
2) HttpContext.Current.Request

You might want, HttpRequest.RawUrl

From msdn:
Remarks
The raw URL is defined as the part of the URL following the domain
information. In the URL string
http://www.contoso.com/articles/recent.aspx, the raw URL is
/articles/recent.aspx. The raw URL includes the query string, if
present.

That or HttpRequest.Url.ToString()
 
Thank you. I found results buried in Intellisense as noted in my own reply
to myself.

<%= Clinton Gallagher
 
Back
Top