Hi Chuck,
From your description, you're using the forms authentication to secure your
ASP.NET web application and is wondering how to redirect those
unauthorized(but authenticated) users to a custom page(other than
login.aspx), correct?
As for this request, I've also met someone else raise this question.
Actually, we can use some code to detect whether the user is an
anonymous(unauthenticated user) or an authenticated but unauthroized(do not
have sufficient permission) one. Here is a code snippet demonstrate this:
====in your login.aspx page=======
protected void Page_Load(object sender, EventArgs e)
{
if (Context.User.Identity.IsAuthenticated)
{
//this is an authenticated but unauthorized user
//redirect it to a friendly page
}
}
=====================
For the custom friendly page, you need to also mark its "authorization"
setting as allow all authenticated user access, e.g.
====allow authenticated user to access that friendly page=======
<location path="friendlyUnauthorizedpage.aspx">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
=============
Hope this helps you. If you have any further questions, please feel free to
let me know.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.