Click here to Skip to main content
15,890,973 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Friends

I really looking forward for assistance , even though I have found tons of solution over the internet but nothing has work.

My problem is I have develop the application in 4.0 c# and while logging , I am not prompting the Login screen but taking the current user by
System.Web.HttpContext.Current.User.Identity.Name.ToString();

its working in via Visual studio , but when I deploy the application in IIS , I am getting it as blank

in iis , I have disabled Anonomous authentication and have enable Windows Authentication , and my web config setting is as below
XML
<authentication mode="Windows"/>
   <authorization>
     <deny users ="?"/>
   </authorization>
   <identity impersonate="true"/>
   <customErrors mode="Off"/>
   <!--
        
       <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
           <error statusCode="403" redirect="NoAccess.htm" />
           <error statusCode="404" redirect="FileNotFound.htm" />
       </customErrors>
       -->
   <httpHandlers>

   </httpHandlers>
 </system.web>
 <system.webServer>
   <validation validateIntegratedModeConfiguration="false"/>
 </system.webServer>



Can anyone one pls give me the solution what setting I have to do it get it worked

Thanks
Posted

1 solution

When you use your local machine, you are logged in as yourself. When you deploy to a server, that server is logged in as someone different to your local machine. I bet that is your problem. You don't have a current user on your server yet, you'd need to log in first.
 
Share this answer
 
Comments
Rickin Kane 13-Jun-13 23:58pm    
No I deployed in the Server and then I accessed the url from my system pointing to my server IIS Address , but when I enable windows authentication its prompt me for user name and password and Currentuser.identity,name is blank ,but when I enable anonymous authentication then , its does not prompt me by default but the identity name is blank
glypticmarsh 3-Mar-16 17:13pm    
ever figure the problem?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900