Re: ASP.NET with ADirectory role based authentication
From: naijacoder naijacoder (naijacoder_at_toughguy.net)
Date: 08/29/04
- Previous message: Dan Amiga: "Re: DPAPI and config files"
- In reply to: Mohamed Sharaf: "Re: ASP.NET with ADirectory role based authentication"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Sun, 29 Aug 2004 05:14:13 -0700
Thanks Mohamed for the link and info.
Are u advicing to add my GROUPS to the code
below(Application_AuthenticateRequest)?
I have retrieved the list of the GROUPS i want to use but where and how
below should i add the GROUP name?
Thanks in Advance!
void Application_AuthenticateRequest(Object sender, EventArgs e)
{
String cookieName = FormsAuthentication.FormsCookieName;
HttpCookie authCookie = Context.Request.Cookies[cookieName];
if(null == authCookie)
{
//There is no authentication cookie.
return;
}
FormsAuthenticationTicket authTicket = null;
try
{
authTicket = FormsAuthentication.Decrypt(authCookie.Value);
}
catch(Exception ex)
{
//Write the exception to the Event Log.
return;
}
if(null == authTicket)
{
//Cookie failed to decrypt.
return;
}
//When the ticket was created, the UserData property was assigned a
//pipe-delimited string of group names.
String[] groups = authTicket.UserData.Split(new char[]{'|'});
//Create an Identity.
GenericIdentity id = new GenericIdentity(authTicket.Name,
"LdapAuthentication");
//This principal flows throughout the request.
GenericPrincipal principal = new GenericPrincipal(id, groups);
Context.User = principal;
}
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
- Previous message: Dan Amiga: "Re: DPAPI and config files"
- In reply to: Mohamed Sharaf: "Re: ASP.NET with ADirectory role based authentication"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]