Dukster131
asked on
Roles validation from Windows authentication
I have been struggling for weeks to figure out how to use my roles authentication when using windows authentication in my web application. My problem is that my users have been entered from a forms login in an application that is not windows authenticated. However, I also have created an intranet site that uses windows authentication. Both user names are the same except the windows authentication adds a domain name to the user.identity.name. So when the application looks for their role it does not find them. I have tried parsing out the domain name, but have not found a good way to make the application recognize the parsed name as the user identity. I have tried the following code, but it does not seem to work.
strUser = Context.User.Identity.Name.ToLower();
string searchString = "\\";
int startNumber = strUser.IndexOf(searchString) + 1;
int endNumber = strUser.Length - startNumber;
strUser = strUser.Substring(startNumber, endNumber);
FormsAuthentication.SetAuthCookie(strUser, false);
//string strReturnURL = "Login.aspx";
//if (Request.QueryString["ReturnURL"] != null)
//{
// strReturnURL = Request.QueryString["ReturnURL"];
//}
MembershipUser currentUser = Membership.GetUser();
FormsAuthentication.RedirectFromLoginPage(strUser, false);
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
I still had to do some configurations on my own after observing the solution I was pointed to.
ASKER