I have a scenario in my application like, need to fetch the current system login userName and check the username with other details. if valid username then need to allow the form to redirect to other page. For that i have used the code to fetch the current login username as :
string userName = HttpContext.Current.User.Identity.Name;
As i am using the current system user details, i went for "windows Authentication mode" and wrote the following code in web.cofig file
<system.web>
<customErrors mode="Off"/>
<compilation debug="true" targetFramework="4.0"/>
<authentication mode="Windows">
</authentication>
<identity impersonate="true"/>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
The whole thing is working fine in my local system. But after publishing the application in IIS and open in web browser it is asking for the username and password credentials with one prompt dialogue. After passsing the current system username and password only it is going to application main page other wise it is showing the error like
"HTTP Error 401.1 - Unauthorized You do not have permission to view this directory or page using the credentials that you supplied."
By goggling for answer i have made some changes like: In IIS, after going to Application i have adjusted the following setting : For authentication : i disabled the "Anonymous and Impersonation" authentication and only enabled the "Windows authentication"
And in windows authentication ,i go for "providers" and Moved the "NTLM" to upper.
what may be the reason for this, How to disable the popup that is asking for the username and password.
Thanks