Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Response.Redirect to HTTPS pages

Posted on 2012-03-29
3
Medium Priority
?
426 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: 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

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

688 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