I am getting a strange result from some standard code.
Anyone got any ideas??
The puzzle
I have a web service calling System.Environment.UserName etc to return the
user name from the server. However, I get back NETWORK SERVICE or a null
string, rather then the user logged on to the client machine.
I have seperate server and client PC's, running XP
SP2 and Server 2003.
I have tried various server configs, - anonymous and not, with clear text,
with digest etc, and various clients. Always get the same result.
Martin Kulov - 06 Nov 2004 10:02 GMT
Hi,
Your web service runs under special account on the server depending on the IIS version that you use. In Win2003 this is NETWORK SERVICE, and in WinXP it is SYSTEM.
What are you trying to achieve? Have in mind that there may be more than one user currently logged on the machine.
Regards,
Martin Kulov
www.codeattest.com
bwmbagus - 07 Nov 2004 17:17 GMT
Thanx for trying.
In fact the problem was just about unsetting anonymous and setting Windows
Authentication for the intranet andf forms authentication for the external
internet access.
I needed a reboot to complete an install forgot about too.
In Wn2003 the App pool thread runs on NT AUTHORITY\NETWORK SEVICE which is
what you get back if you query System.Environment..Username or DomainName. I
had tried some whoami code using this means to access the current user
details copied from some proggy site I found. Need to use Context.User in a
web service.
By the way, there will be many users on the domain, but only one on a
physical client PC.
> Hi,
>
[quoted text clipped - 5 lines]
> Martin Kulov
> www.codeattest.com
Jeff Dillon - 06 Nov 2004 20:11 GMT
Without some authentication mechanism, you can't capture the username. Basic
Authentication works over the Internet, or Windows Auth on an intranet.
Jeff
> I am getting a strange result from some standard code.
> Anyone got any ideas??
[quoted text clipped - 7 lines]
> I have tried various server configs, - anonymous and not, with clear text,
> with digest etc, and various clients. Always get the same result.