authorization different paths and roles

M

Matias Woloski

I have this authorization config in my web.config

<location path="manager">
<system.web>
<authorization>
<deny users="?" />
<allow roles="admins" />
</authorization>
</system.web>
</location>
<location path="resourcemgr">
<system.web>
<authorization>
<deny users="?" />
<allow roles="resourceEditors" />
</authorization>
</system.web>
</location>

I need to give access to the "manager" dir for the "admins" role and access
to "resourcemgr" dir for the "resourceEditors" role

With this config is allowing me to get in the "manager" dir using the
"resourceEditors", and that couldn't be.

Am I missing something?

thanks
MAtias
 
N

naijacoder naijacoder

<location path="manager"> is this path MANAGER a drirectory in IIS or a
group?
Try using <deny> and see if it will go..
Cheers
 
M

Matias Woloski

Writing this, it won't allow anyone to get into manager,

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

However, I still cannot make it work to only allow "admins" role.

any ideas?

thanks!
Matias
 
H

Hernan de Lahitte

Hi Matias,

I assume that you are using Forms Authentication and you are filling the
roles info with the appropriate data. Otherwise if you use Windows Auth you
should add the domain info the group name (role). Regarding the first
scenario, your last config should be fine: (apply the same to the
'resourcemgr' folder with the 'resourceEditors' role)
<location path="manager">
<system.web>
<authorization>
<allow roles="admins" />
<deny users="*" />
</authorization>
</system.web>
</location>

This section may be located in the root web.config file.
You should have this setting in the system.web main section as well.

<authorization>
<deny users="?" />
</authorization>

Notice that all users with the 'admins' role inlcuded in it's roles
collection will be allowed to access the manager folder.


--
Hernan de Lahitte
Lagash Systems S.A.
http://weblogs.asp.net/hernandl


This posting is provided "AS IS" with no warranties, and confers no rights.
 
M

Matias Woloski

Thanks to everyone.

It wasn't a config problem. This was a code I inherit from someone :s The
global.asax was hooked to the AuthenticationRequest event and was getting
the roles from a cookie and didn't refreshed the db role for the user.

thanks again,
Matias
Soutworks
http://blogs.southworks.net/matiaswoloski
 

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

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top