asp.net – 拒绝访问web.config中的“admin”文件夹
发布时间:2020-05-25 03:06:07 所属栏目:asp.Net 来源:互联网
导读:我是ASP.NET的新手,所以原谅我,如果这很简单。 我试图通过web.config拒绝访问我的“管理”文件夹。我查看了另一个类似问题的答案,他们建议使用 location文件夹,但是当我在路径中插入“Admin /”时,我得到以下错误: path attribute must be a relative v
|
我是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 – 在.net应用程序中使用jquery禁用回发上的按钮
- ASP.NET缓存方法分析和实践示例代码
- asp.net – Html.RenderAction和Html.Action之间的区别
- asp.net – Page.IsValid如何工作?
- asp.net – 在IIS上运行Python和Django
- 使用ASP.NET webAPI上载文件(最大文件大小为10Mb)
- ASP.NET Core WebApi将错误消息返回给AngularJS $http prom
- asp.net-mvc-3 – MVC3 = return EmptyResult()当一个好主意
- asp.net-mvc – 文件上传MVC
- asp.net – 基于函数式编程的UI
推荐文章
站长推荐
- asp.net-mvc – 到Spark还是不Spark?
- ASP.NET MVC中的基本认证5
- asp.net-mvc – asp.net mvc如何正确测试控制器
- asp.net – 诊断“请求超时”HttpExceptions
- asp.net核心 – 为什么验证类型 – .NET Core中的
- asp.net-mvc – MVC4 HTML TextBox在修改ViewMod
- asp.net-mvc – Mvc区域路由?
- 如何在ASP.NET中实现实时更新
- asp.net-mvc – 使用jQuery getJson发送list/arr
- asp.net – 太多的Cookie OpenIdConnect.nonce导
热点阅读
