简体   繁体   English

asp.net web.config授权属性可在Visual Studio中使用,但不能在发布时使用

[英]asp.net web.config authorization attributes working in visual studio, but not on publish

Thanks for any help. 谢谢你的帮助。

Edit this has been altered from the initial question, as no answers had been posted, and the problem evolved in more detail 编辑此问题已从最初的问题进行了更改,因为尚未发布任何答案,并且问题更加详细地发展了

I am trying to complete an asp.net 4.0 web application. 我正在尝试完成一个asp.net 4.0 Web应用程序。 I am struggling to manage folder based authorization. 我正在努力管理基于文件夹的授权。

a sample of the XML from the web.config: 来自web.config的XML样本:

<location path="~/drugAdmin">
<system.web>
  <authorization>
    <allow roles="drugAdmin" />
    <deny users="*" />
  </authorization>
</system.web>
</location>
<location path="~/wardAdmin">
<system.web>
  <authorization>
    <allow roles="wardAdmin" />
    <deny users="*" />
  </authorization>
</system.web>
</location>
<location path="~/websiteAdmin">
<system.web>
  <authorization>
    <allow roles="websiteAdmin" />
    <deny users="*" />
  </authorization>
</system.web>
</location>
<location path="~/personalAccount">
<system.web>
  <authorization>
    <deny users="?" />
  </authorization>
</system.web>
</location>

The authorization works beautifully when the web application is started via visual studio. 通过Visual Studio启动Web应用程序时,授权可以很好地工作。

when I publish to a local directory on my machine with the same web.config file, the authorization allows anonymous users into the wardAdmin and personalAccount folders ONLY (ie works appropriately for the other folders). 当我使用相同的web.config文件发布到计算机上的本地目录时,授权仅允许匿名用户进入wardAdmin和personalAccount文件夹(即适用于其他文件夹)。

Has anyone come accross a similar problem and know a solution? 有没有人遇到类似的问题并知道解决方案? thanks 谢谢

replacing the tildes fixed the problem 更换波浪号可解决问题

<location path="drugAdmin">
<system.web>
  <authorization>
    <allow roles="drugAdmin" />
    <deny users="*" />
  </authorization>
</system.web>
</location> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 授权 Asp.net web.config - Authorization Asp.net web.config web.config中的ASP.NET MVC3发布设置 - ASP.NET MVC3 Publish settings in web.config ASP.NET web.config 授权 403 错误 - ASP.NET web.config authorization 403 errors ASP.NET web.config授权设置被忽略 - ASP.NET web.config authorization settings ignored ASP.NET-jQuery load()不遵守web.config授权 - ASP.NET - Jquery load() not respecting web.config authorization 子文件夹中忽略ASP.NET web.config授权设置 - ASP.NET web.config authorization settings ignored in subfolders ASP.NET WebForms Url授权和无限循环。 Web.config无法正常工作? - ASP.NET WebForms Url authorization and an infinite loop. Web.config not working? 在Visual Studio 2013中以不同版本在ASP.NET Web表单中更改Web.config - Web.config change in asp.net web form in different build in visual studio 2013 Visual Studio 2010 + ASP.Net Web项目:在当前文件夹中查找web.config(而不是root) - Visual Studio 2010 + ASP.Net Web Project: Looking in current folder for web.config (instead of root) 如何在Visual Studio 2010中生成ASP.NET 2.0(复古)web.config - How to generate an ASP.NET 2.0 (retro) web.config within Visual Studio 2010
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM