Get LOGON USER name in .NET 2.0

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I recentlly converted some web services to 2.0. So far everything has worked
great with the exception of one of the functions in an AD service.

the following code:
string sUser = HttpContext.Current.Request.ServerVariables["LOGON_USER"];

Worksk fine if debugging in VS 2005 but when I publish to the server. An
empty string is returned. I have tried to catch an error and does not appear
to be one.
 
This does not work for me

'System.Security.Principal.IPrincipal' does not contain a definition for
'Name'


Norman Yuan said:
string sUser = HttpContext.Current.User.Name

Brad King said:
I recentlly converted some web services to 2.0. So far everything has
worked
great with the exception of one of the functions in an AD service.

the following code:
string sUser = HttpContext.Current.Request.ServerVariables["LOGON_USER"];

Worksk fine if debugging in VS 2005 but when I publish to the server. An
empty string is returned. I have tried to catch an error and does not
appear
to be one.
 
What form of authentication are you using in your application? Forms?
Windows? What is the IIS application configured to use? Anonymous? Integrated?

Brad King said:
This does not work for me

'System.Security.Principal.IPrincipal' does not contain a definition for
'Name'


Norman Yuan said:
string sUser = HttpContext.Current.User.Name

Brad King said:
I recentlly converted some web services to 2.0. So far everything has
worked
great with the exception of one of the functions in an AD service.

the following code:
string sUser = HttpContext.Current.Request.ServerVariables["LOGON_USER"];

Worksk fine if debugging in VS 2005 but when I publish to the server. An
empty string is returned. I have tried to catch an error and does not
appear
to be one.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top