Last post Aug 13, 2013 08:51 AM by sh_asp.net
Aug 09, 2013 11:20 AM|sh_asp.net|LINK
is working fine in my dev machine. If i copy to iis it is returning Network service.
How to fix it Any Idea?
I tried by using identitiy impersonate=true and removing anonyms authendication in iis
Aug 09, 2013 11:05 PM|romy.thomas|LINK
When you run it locally in your login, certinly it will return the current user. but when you deploy it in IIS and try to access it using IIS deployed path, as per my understaing the user will be IUSER and that is the reason why its returning Network Service.
Aug 11, 2013 04:09 PM|sh_asp.net|LINK
Hi Romy Thomas,
Thanks for the reply.
I had disabled the anonyms user (IUSER...) in IIS.
No Luck :)
Aug 12, 2013 11:29 AM|Steven Cheng - MSFT|LINK
What you expect to get from the System.Security.Principal.WindowsIdentiy.GetCurrent() method call?
The value returned from the method call depends on your security authenticaiton setting and service account configured in IIS server. If you configure IIS application to use Windows authentication and disable anonymous access, this method call will give
you the authenticated windows identity from client request. Otherwise, if you enable anonymous access or doesn't use Windows authentication in IIS, then this method call will give you the current windows account used for running the IIS worker process. And
you can configure the worker process's execution account by configuring the IIS application pool identity.
#Application Pool Identities
#Specify an Identity for an Application Pool (IIS 7)
For IIS 6, the configuration will be a bit different:
#Steps for setting up a custom identity of an IIS 6 application pool
#Configuring Application Pool Identity with IIS 6.0 (IIS 6.0)
So if you want to let your ASP.NET web application (IIS worker process) execute under a particular account, you can specify it in the IIS application pool. By default, IIS 6 uses "Network Service" as the default application pool identity.
Aug 13, 2013 08:51 AM|sh_asp.net|LINK
The issue is with identity impersonate in the code behind.
The Active Directory code is crashing if identity impersonate = true in web.config
So after that enclosing the AD code with
constructs fixed the issue
Thanks for your valuable point