asp.net - 如何使 ASP.NET 应用程序仅通过 HTTPS 提供页面服务?

标签 asp.net https web-config

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

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

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

Build (web): Unrecognized configuration section secureWebPages.

我正在运行 Visual Studio 2008

最佳答案

听起来您可能需要添加适当的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>

关于asp.net - 如何使 ASP.NET 应用程序仅通过 HTTPS 提供页面服务?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2976550/

相关文章:

c# - 如何在这个 .aspx 页面上实现可折叠部分?

asp.net - typescript 在构建时编译不起作用

asp.net - asp.net core 中 web.config 文件的替代项是什么

ssl - 强制使用 HTTPS 将页面重定向到 http ://http/url

c# - 有没有办法在 ASP.NET Core 3.1 应用程序端点中应用服务器 SSL 证书?

c# - 在子页面中覆盖母版页 CSS div 宽度

c - 使用纯 C 通过 SSL (HTTPS) 的 WinInet POST?

javascript - 在 iframe 中从 https 加载页面时出现混合内容错误

java - 在 Java 中从 HTTPS URL 下载图像

c# - 未选中匿名访问时无法访问该网站