How to get UserName of logon control from code
- From: Froefel <hansdeschryver@xxxxxxxxx>
- Date: Wed, 11 Jul 2007 14:02:01 -0000
I have added a Login control to a Master Page. the control shows the
currently logged in user (domainname\username).
In one of the content pages, I need to access this name.
I noticed that the Login control has a UserName property but it's in
the Nonpublic properties, so it's not accessible from my code.
I was trying to get to the name as follows:
string username = ((LoginName)
Master.FindControl("lnLoginName")).UserName;
but that's failing...
I was thinking of adding the username to a session variable, but I
have a feeling that it's not the right approach in today's new world
of web programming.
Does anyone know how to get the current username in a code-behind file
for a content page? Or is there something fundamental that I'm
missing?
Thanks in advance.
-- Hans
.
- Follow-Ups:
- Re: How to get UserName of logon control from code
- From: antonyliu2002@xxxxxxxxx
- Re: How to get UserName of logon control from code
- From: Tim Payne
- Re: How to get UserName of logon control from code
- Prev by Date: Re: XmlSiteMapProvider: How to hide siteMapNode to a certain role?
- Next by Date: Re: How to get UserName of logon control from code
- Previous by thread: Word 2003 and ASP.net 2.0
- Next by thread: Re: How to get UserName of logon control from code
- Index(es):
Relevant Pages
|
Loading