Solved

Response.Redirect to HTTPS pages

Posted on 2012-03-29
3
407 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video discusses moving either the default database or any database to a new volume.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now