RE: RoleProvider Capturing Authentication Events



Hello Chuck,

From your description, in your ASP.NET forms authentication secured web
application, you want to make those users (that will be redirected to the
login page) see different pages depend on whether they're unauthenticated
or doesn't have sufficient permission(role), correct?

If this is the case, I think the simplest and most convenient means is to
customize your login page and check the HttpContext.Current.User.Identity
to see whether it is authenticated. Because if a user is redirect to login
page due to unauthenticated, the Identity should be unauthenticated too,
while if the user is redirected due to unsufficient permission, it should
already has an authenticated identtiy. e.g.

=====in login page code==============
protected void Page_Load(object sender, EventArgs e)
{

if (Context.User.Identity.IsAuthenticated == true)
{
Server.Transfer("~/AccessDeniedPage.aspx");
//or use response.redirect(....)
}
}

==============

Also, you need to make sure you add authorization setting to allow all
authenticated users to access the "AccessDeniedPage" in web.conifg
====in web.config======
.............
<location path="AccessDeniedPage.aspx">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
...................
============================

Hope this helps.

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.

.



Relevant Pages

  • RE: Login control and restricted member pages
    ... I think it is likely caused by windows ... Microsoft MSDN Online Support Lead ... where an initial response from the community or a Microsoft Support ... Login control and restricted member pages ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Forms Authentication - Sudden Redirect Failure on Login
    ... login page and executable to the production environment failed, ... web app in VS 2005 using forms authentication. ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • RE: WMP 11 Download Songs from URGE
    ... it's a music online download site that need to login to use its service. ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.vb.general.discussion)
  • RE: Email resent on page refresh
    ... So if I redirect then I do not get duplicate email send. ... event handler will not be executed again. ... Microsoft Online Support ... nature are best handled working with a dedicated Microsoft Support Engineer ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: WMP 11 Download Songs from URGE
    ... | it's a music online download site that need to login to use its service. ... normally accessing such web site programmatically ... | Microsoft Online Community Support ... | where an initial response from the community or a Microsoft Support ...
    (microsoft.public.vb.general.discussion)