Solved

Hosting and redirect to https

Posted on 2013-05-16
3
490 Views
Last Modified: 2013-05-17
Hello experts,
I’ve run into an issue. I’ve developed an ASP.NET site with a Master Page structure for a client who already had hosting set up on 1and1. We needed to install an SSL cert. All works great EXCEPT when they try and reference the site without https://www.clientsite.com when the go to the old linky http://www.clientsite.com obviously nothing is found. Normally I’ve had access to the sever in which I could load Microsoft’s redirect module or use Go Daddy who has the module installed. Well as things would have it 1and1 is several decades behind in the server side technology and I’m struggling to find any way to redirect.
I’ve tried a couple different approaches including adding redirects such as these to both the master page and default page with  no luck:
If Not Request.Url.Scheme = "https" Then
     Response.Redirect("https://www. clientsite.com/Home")
End If

I contacted 1and1 and they sent me this:
http://help.1and1.com/domains-c36931/domain-administration-c79822/ssl-certificates-c39129/how-do-i-redirect-traffic-to-my-ssl-secured-site-a618201.html

I’m not sure I see the relevance as I’m using a master and that seems to reference .asp vs .aspx further I’ve done an almost identical scenario in the code above.

Any direction would be great.
0
Comment
Question by:thenrich
[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
3 Comments
 
LVL 3

Expert Comment

by:DaveKeyes
ID: 39173975
This how I am doing that in a MVC web site, in the Home Controller module:

                if (Request.Url.Scheme != "https")
                    {
                    var baseUri = new Uri("https://" + Request.Url.Host);
                    var relUri = new Uri(Request.CurrentExecutionFilePath, UriKind.Relative);

                    return (Redirect(new Uri(baseUri, relUri).ToString()));
                    }
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 39174408
They are asking you to create a default.asp file which is what IIS will try to serve on http. In the asp file, user will then be redirected to https. Try putting that code in a default.asp and placing in your root folder.
0
 
LVL 5

Author Closing Comment

by:thenrich
ID: 39174465
I ended up doing this plus adjusting the default page in my web.config
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

752 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