我想在 ASP.NET Web 应用程序中使用 HTTPS,但仅限于 Login.aspx 页面。
如何实现这一点?
最佳答案
首先获取或创建证书
从 http://www.codeproject.com/Articles/7206/Switching-Between-HTTP-and-HTTPS-Automatically-Ver 获取 SecureWebPageModule 模块。设置说明可在文章中找到。
将 secureWebPages 标记添加到 web.config
<configuration> ... <secureWebPages enabled="true"> ... </secureWebPages> ... <system.web> ... </system.web> </configuration>
添加用于 https 协议(protocol)的文件和目录:
<secureWebPages enabled="true"> <file path="Login.aspx" /> <file path="Admin/Calendar.aspx" ignore="True" /> <file path="Members/Users.aspx" /> <directory path="Admin" /> <directory path="Members/Secure" /> </secureWebPages>
希望这有帮助!
关于asp.net - 如何在 ASP.Net 应用程序中使用 HTTPS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/539732/