asp.net – 如何允许匿名用户访问虚拟目录
发布时间:2020-12-16 07:13:24 所属栏目:asp.Net 来源:网络整理
导读:我目前阻止匿名用户访问我的根应用程序. /web.config system.web authorization deny users="?" / /authorization /system.web 但我允许匿名访问公共资源(图像,CSS等): location path="Images" system.web authorization allow users="*" / /authorization
我目前阻止匿名用户访问我的根应用程序.
/web.config <system.web> <authorization> <deny users="?" /> </authorization> </system.web> 但我允许匿名访问公共资源(图像,CSS等): <location path="Images"> <system.web> <authorization> <allow users="*" /> </authorization> </system.web> </location> 现在,我想添加一个匿名用户可以访问的虚拟目录.我添加了一个基于Images路径的配置,但每当我尝试访问该位置时,我都会被重定向到登录页面,并将ReturnURL设置为虚拟目录. <location path="virtualDirectory"> <system.web> <authorization> <allow users="*" /> </authorization> </system.web> </location> 另外,我试图在我的虚拟目录的web.config中指定全局授权但是得到一个错误,说我只能有一次 /virtualDirectory/web.config: <system.web> <authorization> <allow users="*" /> </authorization> </system.web> 当我的根应用程序阻止匿名访问时,如何允许匿名访问虚拟目录? 解决方法
在你的全局web.config中封装了
<system.web> <authorization> <deny users="?" /> </authorization> </system.web> 同 <location path="." inheritInChildApplications="false"> <system.web> <authorization> <deny users="?" /> </authorization> </system.web> </location> 这意味着 – 授权仅在root应用程序中实施,而不是针对子应用程序. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
- asp-classic – 是否有像Visual Studio一样的ASP
- asp.net – 将GridView导出到多个Excel工作表
- asp.net – 使用Ajax,在服务器或客户端生成额外的
- asp.net-mvc – MVC 3 tempdata容器的缺点
- asp.net-mvc – 具有多个参数的ActionLink
- asp.net – 在web.config中创建一个字符串并在we
- asp.net-core – 在没有Visual Studio 2015的情况
- 谈谈基于SQL Server 的Exception Handling[中篇]
- asp.net – LINQ to SQL – 如何选择特定的列和返
- 腾讯云-容器-mysql搭建_进入退出和常用查询
热点阅读