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

From: Gery D. Dorazio (gdorazio_at_enque.net)
Date: 08/10/04


Date: Tue, 10 Aug 2004 03:28:11 -0400

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


Relevant Pages

  • Authorization and Profile Application Block generates errors when using whithin Web Application
    ... I am trying to use the "Authorization and Profile Application Block" ... Referenced Class: ... this method cannot find my config file entries... ...
    (microsoft.public.dotnet.distributed_apps)
  • Re: authentication mode for specific files?
    ... the web config. ... I have an img tag to an image in ... config file to specify specific files that do not require ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: web.config question
    ... "bill" wrote in message ... > my web.config for a specific folder that checks IP ... > config file that would allow access only from specific IP ... There is no built-in authorization module which restricts by IP address. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Checking IsAuthenticated for new ASP.NET session
    ... again...my issue is that I do not want to redirect a user to the login ... force authentication by denying authorization to index.aspx for all ... lets say you are an admin user and this is your ... but all the pages now have 5 javascript menus. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Dynamic page security authorization?
    ... Craig you could have a folder called Admin and under the Admin folder add ... And later apply the neccesary Authorization. ...
    (microsoft.public.dotnet.framework.aspnet.security)

Loading