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.
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.