DNN重定向到https

时间:2012-07-10 21:02:03

标签: ssl dotnetnuke

我们在Windows 2003x64中有一个自托管的DNN 6.01.03站点,标准版。

我们已经启用它使用SSL,但是我们想要设置它,以便通过HTTP的用户被重定向到HTTP。

有办法吗?似乎在IIS7中我们可以使用IIS Rewrite URL模块,但这是IIS6。

请指教。谢谢。

4 个答案:

答案 0 :(得分:6)

最快的方法是在DNN中将网站设置为“强制SSL”。

我注意到使用IFinity.com.au中的UrlMaster等工具时行为更好。

答案 1 :(得分:3)

设置重定向页面并在那里指出403.4错误。重定向页面将是强制执行SSL的唯一网址。

1。创建重定向页面

您可以在此处使用几乎任何可用的网络技术。

示例:

在ASP.NET中,redirect.aspx可以用与在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。检查重定向页面上是否未强制执行SSL

Edit redirect.aspx propertis in IIS Manager

3。将403.4错误指向重定向页面URL

enter image description here

另见:

答案 2 :(得分:1)

帮助他人:答案来自2个不同的人:

1)如Mitchel所述,请转到您的DNN站点设置,启用SSL并强制执行SSL。网站设置&gt;高级设置&gt; SSL设置&gt;选中“启用SSL并强制执行SSL”

Site Settings

2)正如布鲁斯指出的那样,你必须转到每个页面并使其成为一个安全的页面。页面设置&gt;其他设置&gt;检查“安全”。我必须为所有页面执行此操作...甚至是站点管理员和设置页面。

Page Settings

答案 3 :(得分:0)

您可以在 Global.asax 中设置重定向以强制对托管域上的 ALL 页面请求进行重定向。这将比任何 DNN 设置具有更高的优先级。

<script RunAt="server">
protected void Application_BeginRequest(object sender, EventArgs e)
{
  // ENABLE SSL REDIRECTS
  if (!HttpContext.Current.Request.IsSecureConnection)
  {
    Response.Redirect("https://" + Request.ServerVariables["HTTP_HOST"] + HttpContext.Current.Request.RawUrl);
  }
}
</script>

或者如果您使用自定义标头或负载均衡器

<script RunAt="server">
protected void Application_BeginRequest(object sender, EventArgs e)
{
  // ENABLE SSL REDIRECTS
  if (!string.Equals(Request.Headers["X-Forwarded-Proto"], "https", StringComparison.InvariantCultureIgnoreCase))
  {
    Response.Redirect("https://" + Request.ServerVariables["HTTP_HOST"] + HttpContext.Current.Request.RawUrl);
  }
}
</script>