Question

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

Was it helpful?

Solution

replacing the tildes fixed the problem

<location path="drugAdmin">
<system.web>
  <authorization>
    <allow roles="drugAdmin" />
    <deny users="*" />
  </authorization>
</system.web>
</location> 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top