Solved

Hosting and redirect to https

Posted on 2013-05-16
3
481 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
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

777 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