4

タイトルのように。たとえば、ドメイン全体をリダイレクトする方法:http: //testdomain.com.au/からhttps://testdomain.com.au/ IIRFファイルでリダイレクトできますか?はいの場合、これはどのように見えるべきですか?IIRFファイルをサイトにバインドする方法は?

4

1 に答える 1

10

あなたは:を介してこれを行うことができIIS Rewrite moduleます

http://www.iis.net/downloads/microsoft/url-rewrite

http://www.iis-aid.com/articles/how_to_guides/redirect_http_to_https_iis_7

<rule name="HTTP to HTTPS redirect" stopProcessing="true">
  <match url="(.*)" />
    <conditions>
      <add input="{HTTPS}" pattern="off" ignoreCase="true" />
    </conditions>
   <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
</rule>

Global.asaxまたは、ファイルを介してリダイレクトできます。

protected void Application_BeginRequest(Object sender, EventArgs e)
{
    if ( !Request.IsSecureConnection)
    {
            string path = string.Format("https{0}", Request.Url.AbsoluteUri.Substring(4)); 

            Response.Redirect(path);
    }
}

http://forums.asp.net/t/1340392.aspx

于 2012-09-13T11:50:11.803 に答える