I run a website app using IIS and asp.net. I am using Windows authentication. When a user logs in, a dialogue pops up where the user has to enter the user name as \ and their Windows password. Most user forget to enter the domain name and this results in a lot of support calls. I get the user name with the following code:

userName = HttpContext.Current.User.Identity.Name;

How can I intercept the user login and prefix the userName with domain name in the code so the user can just log in with user name and password?

Is that even possible?

  • I don't work with IIS very often but I thought that when using Windows Authentication that the browser passed the credentials of the logged in user, so why would the users be getting an authentication prompt to begin with? – joeqwerty Sep 9 '15 at 20:46
  • that usually indicates that the site isn't detected as being within the intranet. Windows authentication information is only forwarded to intranet sites. You can use group policies to change the way intranet sites are detected or maintain a list of known intranet sites. – Dirk Trilsbeek Sep 10 '15 at 17:10

The browser may pass on the user name, but not the password, unless the user saved the password on earlier visit.


Yeah I work under the shadow of IT. The site is not officially part of Intranet. Sorry if this was misleading. I run IIS and allow access to certain people to do their work internally within the company. Does that clarify?

  • Is this an answer to the question? I'm confused as to what this is. – joeqwerty Sep 10 '15 at 19:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.