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

StackOverflow https://stackoverflow.com/questions/13060116

سؤال

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. I am struggling to manage folder based authorization.

a sample of the XML from the web.config:

<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.

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).

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 مع الإسناد
لا تنتمي إلى StackOverflow
scroll top