ASP.NET 中 HTML 个页面的 FormsAuthentication

FormsAuthentication for HTML Pages in ASP.NET

假设我们有 3 个网页,其中两个名称是 Main.aspx(默认 url)和 Login.aspx(登录 url), 第三个是index.html。 当我想看 index.html 它没有登录页面, 我应该如何使用表单身份验证来保护此页面?

如何将 .html 和其他非 .NET 扩展添加到有效的扩展列表以交给 .NET 引擎?

<authentication mode="Forms">
  <forms defaultUrl="MainPage.aspx" loginUrl="LoginPage.aspx">
  </forms>
</authentication>
<authorization>
  <deny users="?"/>
</authorization>

将 html 页面放入文件夹中,并在新创建的 web.config 设置中将新的 web.config 添加到该文件夹​​,拒绝匿名用户访问。

<authorization>
    <deny users="?"/>
</authorization>