How can the location roles be read from the web.config file?

G

Gery D. Dorazio

Security Experts,

I have a config file such as this:

<configuration>
<system.web>

<!--- other stuff goes here -->

<authentication mode="Forms">
<forms name=".MyWebsite" loginUrl="Login.aspx" protection="All"
timeout="60" path="/"></forms>
</authentication>

<authorization>
<allow users="*" /> <!-- Allow all users -->
</authorization>

</system.web>

<location path="Admin" allowOverride="false">
<system.web>
<authorization>
<allow roles="Admin" />
<deny users="?" />
</authorization>
</system.web>
</location>

<location path="Account" allowOverride="false">
<system.web>
<authorization>
<allow roles="User,Admin" />
<deny users="?"/>
</authorization>
</system.web>
</location>

</configuration>


As you can see there are two directories 'Admin' and 'Account' which have
respectively the roles "Admin" and "User,Admin". I would like to be able to
programmatically read these role values from withing ASP.NET. How can I do
it?


Thanks,

Gery




--
Gery D. Dorazio
Development Engineer

EnQue Corporation
1334 Queens Road
Charlotte, NC 28207
(704) 377-3327
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top