checking the url

  • Thread starter Thread starter Rob
  • Start date Start date
R

Rob

Hello

I am trying to redirect users to a secure page by using
Response.Redirect(Request.Path.Replace("https://",http://"))
or
Response.Redirect(Request.RawUrl.Replace("https://",http://"))

both of which I have seen suggested on this newsgroup.

However, both Request.Path and Request.RawUrl return the url after the
domain, ie instead of http://somedomain.com/abc.aspx I get just
abc.aspx so neither method works.

I have formed the url using
Request.ServerVariables["SERVER_NAME"]
and
Request.ServerVariables["URL"]

But it bothers me that the 2 previously suggested methods won't work.
Is there a configuration setting to make ASP.NET return the full url
including protocol, server name and query strings ? Or am I doing
something else wrong ?

Thanks in advance
Rob
 
Back
Top