I have a site that requires Windows Authentication the application obtains the credential from the Security.Prinicipal once the user is autenticated the problem is that my credentials on my local environment are different that the ones stored in the DB and the user preferences cannot be obtain. i am doing the following workaround in order to deal with this issue.
#if DEBUG var myUser = userBL.GetSingle(@'desiredDomain\otherUserName'); #else var myUser = userBL.GetSingle(HttpApplication.User.Identity.Name); #endif Session.Add('User',myUser);
is there any other way rather than impersonating or the above mentioned workaorund to change the the value of HttpApplication.User.Identity.Name this is beacuse I have to change my code everytime I need to commit into repository or deploy the App
While you could alter userBL, why wouldn’t you instead alter the database records to reflect that they’re in a different domain. I’m assuming you’re not hitting the production database, so there should be no issues with a ‘sanitizing’ step that makes the database useable for dev/test.
e.g.