authorization policy help

Y

yofnik

Hello,

Using policy (modifying web.config) and FormsAuthentication, is it
possible to return an error message (or redirect to error page) instead

of redirecting to the login page for specific users only?

Here's an example:
I have a section of my web app that is for admins only. The
authorization section of my web.config looks like.

<authentication mode="Forms">
<forms loginUrl="login.aspx">
<credentials passwordFormat="Clear">
<user name="admin" password="password"/>
<user name="guest" password="password" />
</credentials>
</forms>
</authentication>

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

Now, for the admin section of the web app, I have a seperate location
element:

<location path="admin">
<system.web>
<authorization>
<allow users="admin"/>
<deny users="*"/>
</authorization>
</system.web>
</location>

This ALMOST solves what I want. The only thing I don't like is that if
the user "guest" tries to access the admin section, they get redirected

to the login.aspx page again. Instead, I would like to redirect them to

an error page or just show an error message.

Is this possible at all using policy only (ie - via web.config)?

Thanks.
 

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,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top