且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在不创建Web应用程序的情况下向子文件夹添加身份验证

更新时间:2023-09-20 11:27:10

在网站根目录中的web.config文件中,如果您添加:

In your web.config file in the root of your site, if you add:

<location path="relativePathToDir">
        <system.web>
            <authorization>
                <deny users="?"/>
            </authorization>
        </system.web>
    </location>

这对我来说是使用FormsAuthentication的,如果未通过身份验证,用户将被重定向到默认登录页面

This is working for me using FormsAuthentication, the user gets redirected to the default login page if not authenticated

推荐文章