Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Response.Redirect to HTTPS pages

Posted on 2012-03-29
3
Medium Priority
?
433 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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses
Course of the Month6 days, 9 hours left to enroll

783 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