2012-09-13 4 views
4

제목과 같습니다. 예를 들어 전체 도메인을 리디렉션하는 방법 : http://testdomain.com.au/ ~ https://testdomain.com.au/ IIRF 파일에서 할 수 있습니까? 예인 경우 어떻게해야합니까? IIRF 파일을 사이트에 바인딩하는 방법은 무엇입니까?ASP.NET 사이트 http에서 https로 전체 도메인 리디렉션

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 파일을 통해 리디렉션 할 수 있습니다 :

답변

7

당신은 IIS Rewrite module를 통해이 작업을 수행 할 수 있습니다

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

+0

대단히 감사합니다. IIRF 파일 사용은 어떻습니까? (임에도 불구하고 묻고있어);) – born2fr4g

관련 문제