您可以创建一个新的 .NET Web 窗体应用程序,在其中包含您的 .asp 经典代码,并将以下内容添加到您的 web.config 文件中。确保以集成管道模式运行应用程序池。
这将确保身份验证模块(如表单身份验证)向后兼容 ASP Classic。您的 ASP Classic 代码将受到您的 .NET 代码所使用的相同身份验证机制的保护(如 web.config 中所定义),而不必像您提到的那样实现本地机制。
<system.webServer>
<modules>
<remove name="FormsAuthenticationModule" />
<add name="FormsAuthenticationModule" type="System.Web.Security.FormsAuthenticationModule" />
<remove name="UrlAuthorization" />
<add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" />
<remove name="DefaultAuthentication" />
<add name="DefaultAuthentication" type="System.Web.Security.DefaultAuthenticationModule" />
<remove name="Session" />
<add name="Session" type="Microsoft.AspNet.SessionState.SessionStateModuleAsync, Microsoft.AspNet.SessionState.SessionStateModule, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode" />
</modules>
</system.webServer>