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

x
?
Solved

Hosting and redirect to https

Posted on 2013-05-16
3
Medium Priority
?
508 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 1500 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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…

916 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