asp.net – 拒绝访问web.config中的“admin”文件夹
发布时间:2020-12-16 00:39:02 所属栏目:asp.Net 来源:网络整理
导读:我是ASP.NET的新手,所以原谅我,如果这很简单。 我试图通过web.config拒绝访问我的“管理”文件夹。我查看了另一个类似问题的答案,他们建议使用 location文件夹,但是当我在路径中插入“Admin /”时,我得到以下错误: path attribute must be a relative
我是ASP.NET的新手,所以原谅我,如果这很简单。
我试图通过web.config拒绝访问我的“管理”文件夹。我查看了另一个类似问题的答案,他们建议使用< location>文件夹,但是当我在路径中插入“Admin /”时,我得到以下错误:
我试过放置“Admin”,“/ Admin”& “管理/” <configuration> <connectionStrings> <add name="OliverSalonConnectionString1" connectionString="Data Source=localhost;Initial Catalog=OliverSalon;Integrated Security=True" providerName="System.Data.SqlClient" /> </connectionStrings> <system.web> <compilation debug="false" targetFramework="4.0" /> <authentication mode="Forms"> <forms name="Oliver" loginUrl="Login.aspx" path="/" timeout="20"> <credentials passwordFormat="Clear"> <user name="OliverSalon" password="cuts"/> </credentials> </forms> </authentication> <authorization > <deny users="?"/> </authorization> </system.web> <location path="/Admin"> <system.webServer> <directoryBrowse enabled="false"/> </system.webServer> </location> 解决方法
这是从我的网络表格的日子。
在您的管理文件夹中放置一个web.config。 内容应为: <?xml version="1.0" encoding="utf-8"?> <configuration> <system.web> <authorization> <allow roles="admin" /> <deny users ="*" /> </authorization> </system.web> </configuration> **编辑回答你的问题 <authentication mode="Forms"> <forms loginUrl="Login.aspx" timeout="20" slidingExpiration="true" cookieless="AutoDetect" protection="All" requireSSL="false" enableCrossAppRedirects="false" defaultUrl="Default.aspx" path="/"/> </authentication> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc-2 – 如何在Asp.net MVC 2中使用Base ViewMode
- asp.net-mvc – 自定义DataAnnotations Validator派生自Reg
- asp.net-mvc-3 – ASP.NET MVC3条件验证EditorTemplate的嵌
- asp.net-mvc – 为什么我在MVC3控制器中的模型中更新的值没
- asp.net-mvc – 如何为ASP.NET MVC编写自己的View引擎?
- 使用ASP.Net和C#计算WebSite中的访问者数量
- asp.net-mvc – Moq的意外验证行为
- 在ASP.NET MVC 3中以特定格式验证日期
- 为什么asp.net将页面包装在一个表单中?
- asp.net-core – 为什么要在src文件夹中组织项目?
推荐文章
站长推荐
- asp.net-mvc-3 – 一个窗体中的多个提交输入
- asp.net-mvc – C#MVC FindPartialView无法找到路
- 无法计算asp.net页面上的加载时间
- asp.net – 什么是关键字如果Page.IsPostBack如何
- asp.net – SQL使用逗号分隔值和IN子句
- asp.net-mvc – asp.net mvc授权使用角色
- 在asp.net mvc2项目中不需要MS脚本的JQuery验证
- asp.net-mvc-3 – 在远程部署MVC3时获取“CS0103
- asp.net-mvc-2 – 仅在运行调试器时出现Antiforg
- asp.net TextBox中的值和文本属性(值被Text覆盖)
热点阅读