Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DNN redirect to https

Tags:

ssl

dotnetnuke

We have a self-hosted DNN 6.01.03 site, in Windows 2003x64, std.

We have enabled it to use SSL, but we would like to set it up so an user coming through HTTP gets redirected to HTTPs.

Is there a way to do that? It seems that in IIS7 we could use the IIS Rewrite URL module, but this is IIS6.

Please advise. Thanks.

like image 757
rufo Avatar asked Jul 10 '12 21:07

rufo


3 Answers

The fastest way is to set the site to "Force SSL" in DNN.

I have noticed that the behavior is better when using a tool like UrlMaster from IFinity.com.au.

like image 200
Mitchel Sellers Avatar answered Nov 01 '22 08:11

Mitchel Sellers


Set up a redirect page and point 403.4 errors there. The redirect page will be the only url that doesn't enforce SSL.

1. Create a redirect page

You can use pretty much any available web technology here.

Examples:

  • client-side html/js (requires javascript)
  • Classic ASP

In ASP.NET, the redirect.aspx can be written in a similar way to which it is done in Classic ASP:

<%@ Page Language="C#" %>

<!DOCTYPE html>

<script runat="server">
    protected void Page_Load(object sender, EventArgs e) 
    {   
        if (!Request.IsSecureConnection)
        {
            string query = Request.ServerVariables["QUERY_STRING"];
            query = query.Replace("http:", "https:");
            query = query.Replace("403;", "");
            query = query.Replace(":80", "");
            Response.Redirect(query);
        }
    }
</script> 

<html>
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        Redirecting...
    </div>
    </form>
</body>
</html>

2. Check that SSL is not enforced on the redirect page

Edit redirect.aspx propertis in IIS Manager

3. Point 403.4 errors to the redirect page url

enter image description here

See also:

  • asp.net c# redirecting from http to https
  • Automatically Redirect HTTP requests to HTTPS on IIS 6
  • IIS: Redirect from http to https
like image 38
mika Avatar answered Nov 01 '22 08:11

mika


To help others: The answer here comes in 2 parts from 2 different people:

1) As Mitchel state, go to your DNN site setting, Enable SSL and Enforce SSL. Site Settings > Advanced Settings > SSL Settings > Check both, "Enable SSL and Enforce SSL"

Site Settings

2) As Bruce pointed out, you then have to go to each page and make it a secure page. Page Settings > Other Settings > check "Secure". I had to do this for all of the pages... even Site Admin and Settings Pages.

Page Settings

like image 28
7huan Avatar answered Nov 01 '22 09:11

7huan