Solved

Response.Redirect to HTTPS pages

Posted on 2012-03-29
3
412 Views
Last Modified: 2012-03-29
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: ?
0
Comment
Question by:whiwex
  • 2
3 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 37783228
You can put the following code in order form itself to do the proper redirection

http://www.mickgenie.com/redirect-ssl-secured-page-from-asp-net/
0
 

Author Comment

by:whiwex
ID: 37783504
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
0
 

Author Comment

by:whiwex
ID: 37783572
Never mind I figured out how to use index of. Thanks this should work
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question