2010-06-04 1 views
2

나는 내 응용 프로그램이 SSL을 통해 해당 웹 페이지의 모든 서비스를 제공 할, 그래서 난 내의 Web.config에 ... 선 ...ASP.NET 응용 프로그램이 HTTPS를 통해서만 페이지를 제공하도록하려면 어떻게합니까?

<secureWebPages enabled="true"> 
<directory path="." /> 
</secureWebPages> 

을 추가하고 결과 컴파일러 오류는 다음과 같습니다

빌드 (웹) : secureWebPages 구성 섹션을 인식 할 수 없습니다.

당신이 당신의 전체 웹 응용 프로그램에 대해 작업 할 수있는 간단하고 빠른 해결책을 원하는 경우에 나는 비주얼 스튜디오 2008

+0

가능한 중복 http://stackoverflow.com/questions/2393114/how-to-secure-login-and ... 소리 -member-area-with-ssl-certificate – citronas

+0

사이트에서 실행중인 .NET Framework 버전은 무엇입니까? –

답변

3

를 실행하고, 당신은 당신의 Global.asax 파일의 Application_BeginRequest 방법이를 추가 할 수 있습니다. 적절한 configSections 추가해야 할 수도 있습니다처럼

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) 
... 
    If Request.IsSecureConnection = False Then 
     Dim ub As New UriBuilder(Request.Url) 
     ub.Scheme = Uri.UriSchemeHttps 
     ub.Port = 443 
     Response.Redirect(ub.Uri.ToString, True) 
    End If 
... 
End Sub 
5

은의

<configuration> 
    <configSections> 
    <!-- modify as you need. --> 
    <section 
     name="secureWebPages" 
     type="Hyper.Web.Security.SecureWebPageSectionHandler, 
     WebPageSecurity" 
     allowLocation="false" /> 
    </configSections> 


    <secureWebPages mode="On" > 
    <directories> 
     <add path="/" recurse="True" /> 
    </directories> 
</secureWebPages> 
관련 문제