this is what i did
Code:
protected void WindowsAuthentication_OnAuthenticate(Object sender, WindowsAuthenticationEventArgs e)
{
FormsAuthenticationTicket formsAuthTicket;
HttpCookie httpcook;
HttpCookie cookieName;
String encryptedTicket;
String strUserIdentity;
DBconn getUser_Roles = new DBconn();
strUserIdentity = e.Identity.Name;
string[] temp = strUserIdentity.Split('\\');
strUserIdentity = temp[1];
cookieName = new HttpCookie("cookieName", strUserIdentity);
Response.Cookies.Add(cookieName);
}
protected void Application_AuthenticateRequest(Object sender, EventArgs e)
{
// Fires upon attempting to authenticate the user
FormsAuthenticationTicket formsAuthTicket;
HttpCookie httpcook;
GenericIdentity genIdentity;
String[] roles = new string[5];
String rolesString;
DBconn getUser_Roles = new DBconn();
char[] separators = { '|' };
GenericPrincipal genPrincipal;
string user = Request.Cookies["cookieName"].Value;
genIdentity = new GenericIdentity(user);
rolesString = getUser_Roles.GetUserRoles(user);
if (rolesString != null)
{
roles = rolesString.Split(separators);
}
else
{
rolesString ="normal";
roles = rolesString.Split(separators);
}
genPrincipal = new GenericPrincipal(genIdentity, roles);
HttpContext.Current.User = genPrincipal;
}