Link to home
Start Free TrialLog in
Avatar of whiwex
whiwex

asked on

Response.Redirect to HTTPS pages

I am adding ssl to a site that never had it. I can get it to work but  I need to be able to test my code on a test server which doesn't have ssl. So I was thinking of checking a variable and depending  on it's value I would redirect to a http or a https.
   
I am using this code that works fine to non secure pages.
Response.Redirect("~/Orders/Order Form.aspx")

What I want to do is this
If GetUsesSSL = "Yes" Then
              'This is the none secure site
                Response.Redirect("~/Orders/Order Form.aspx")
                Exit Sub
Else
               'This is the secure site
                Response.Redirect("https://" & "~/Orders/Order Form.aspx")
                Exit Sub
End If

What is the syntax to use the existing directory with https: ?
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of whiwex
whiwex

ASKER

What is strURL.IndexOf ? I put your code in the page load. I was hopeing that it would redirect the order form  to https://order form  but it doesn't . the strURL.IndexOf("http:") returns a 0
Avatar of whiwex

ASKER

Never mind I figured out how to use index of. Thanks this should work