Is it possiable to create an access rule for a file?

G

Guest

I vaguely recall that ASP.NET 1.1 had a way to specify specific pages and
associate required roles to access those pages.. Is there something similar
to that in ASP.NET 2.0? IE, I would like to say that all pages are open,
except x.aspx, y.aspx, and z.aspx. These pages require roles, a,b,c.. Looking
at the allow element, there is no page or related property..??
Sorry if this was already answered..
Thanks for the help..
 
J

Jeff T

I vaguely recall that ASP.NET 1.1 had a way to specify specific pages and
associate required roles to access those pages.. Is there something similar
to that in ASP.NET 2.0? IE, I would like to say that all pages are open,
except x.aspx, y.aspx, and z.aspx. These pages require roles, a,b,c.. Looking
at the allow element, there is no page or related property..??
Sorry if this was already answered..
Thanks for the help..

In the web.config for a directory or the main one you can setup the
<authorization> part to do what you need.

If you want to restrict a certain page you need to put the
authorization in a <location> section for that page or path.

For example:

<location path="x.aspx">
<system.web>
<authorization>
<allow roles="a,b,c" />
<deny users="*" />
</authorization>
</system.web>
</location>
 

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,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top