Home All Groups Group Topic Archive Search About

Get LOGON USER name in .NET 2.0

Author
23 Feb 2007 9:53 PM
Brad King
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.

Author
25 Feb 2007 4:57 AM
Norman Yuan
string sUser = HttpContext.Current.User.Name

Show quote
"Brad King" <BradK***@discussions.microsoft.com> wrote in message
news:911E5550-9004-4E39-A54D-CF10FE22829C@microsoft.com...
>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.
>
Author
27 Feb 2007 4:35 PM
Brad King
This does not work for me

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


Show quote
"Norman Yuan" wrote:

> string sUser = HttpContext.Current.User.Name
>
> "Brad King" <BradK***@discussions.microsoft.com> wrote in message
> news:911E5550-9004-4E39-A54D-CF10FE22829C@microsoft.com...
> >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.
> >
>
>
>
Author
2 Mar 2007 5:18 AM
Adam Wayne
What form of authentication are you using in your application? Forms?
Windows? What is the IIS application configured to use? Anonymous? Integrated?

Show quote
"Brad King" wrote:

>
> This does not work for me
>
> 'System.Security.Principal.IPrincipal' does not contain a definition for
> 'Name'   
>
>
> "Norman Yuan" wrote:
>
> > string sUser = HttpContext.Current.User.Name
> >
> > "Brad King" <BradK***@discussions.microsoft.com> wrote in message
> > news:911E5550-9004-4E39-A54D-CF10FE22829C@microsoft.com...
> > >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.
> > >
> >
> >
> >

AddThis Social Bookmark Button