Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirect to relative URL, but change to HTTPS

Status
Not open for further replies.

alan6895

Programmer
Aug 3, 2007
48
US
Does anyone know of a way that I can use Response.Redirect to send the user to a new relative path, but change the protocol to HTTPS?

Users enter on an unencrypted page, so if I use Response.Redirect("./whatever.aspx") it transfers the user but, obviously, not the protocol. However, the page it transfers to requires SSL. So, can I make it more like "transfer to this relative path, but also switch to SSL?"

Thanks!
 
I'm using explicit now. The problem is that the application needs to easily be "portable" between folders. I'm leaving where I am soon and the people who will be taking my applications are not familiar with them.

That said, if I don't have a solution, I'll just be using explicit paths anyway.

Thanks for the suggestion, Turkbear.
 
get the raw URL from the Request and replace 'http' with 'https'. Although this whole thing feels hackish... there should be a better way to require a secure resource.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
That's what I'm considering, jmeckley. I figure I could get the current path, replace http with https, and then append the "relative" path to the current path.

On the other hand, I think what I will do is set the top-level, non-SSL pages to check for and redirect themselves to use SSL, as per
And I agree that there should be a better way to redirect. I'd like something like Response.Redirect(URL, protocol).

Thanks for your input!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top