如何使我的ASP.NET应用程序仅通过HTTPS提供页面?

use*_*951 2 asp.net https web-config

我希望我的应用程序通过SSL提供所有网页,所以我添加了行...

<secureWebPages enabled="true">
<directory path="." />
</secureWebPages>
Run Code Online (Sandbox Code Playgroud)

...到我的Web.config和生成的编译器错误是:

构建(Web):无法识别的配置部分secureWebPages.

我正在运行Visual Studio 2008

p.c*_*ell 5

听起来你可能需要添加适当的configSections......

<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>
Run Code Online (Sandbox Code Playgroud)