ADNSF version: 7.1
Hi,
I'm trying to map windows user accounts to ADNSF customers using the email address. I turned off forms authentication and turned on windows authentication. I can retrieve the windows suer, get his email address, find the CustomerID with the same email address in the database - no problem. The trouble is that I'm not able to create a new Customer object and set it as the currently logged on user. Here are the details:
I do all that in Global.asax (the original code behind is not in source code anymore, so I had to create a child class of it). There is an event handler for the WindowsAuthentication module:
public void WindowsAuthentication_OnAuthenticate(object sender, WindowsAuthenticationEventArgs e)
{
Customer c = GetRelatedCustomer(e);}
e.User = new AspDotNetStorefrontPrincipal(customer);
This is the default procedure to create custom IPrincipal objects when using windows authentication. The IPrincial applied to e.User will normally show up in HttpContext.Current.User. In this case, it doesn't. I suspect that the compiled code behind of Global.asax replaces the IPrincipal object afterwards. Is that true? How can I assign my own IPrincipal to HttpContext.Current.User? I cannot do that in signin.aspx because then the HttpContext.Current.User has already been replaced and I won't find information about the logged-on windows user.
Any help is appreciated.
Best regards,
Munir Husseini