F
Froefel
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
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