Grab a User's Logon name in ASP.NET form?

K

Kelly

Hi all -

I've made an ASP.NET application that will allow users to edit certain
project data throughout the year. I now need to add some security and only
allow users access to the projects they've been assigned.

I would like to make a label on the start-up web form that gives a little
welcome...something like "Welcome, <UserID>! Please choose a project." Based
on their UserID, my drop-down list box should populate a list of projects
for that one user, kwim?

How do I go about capturing the user's logon name though?

Thanks for your help!
 
S

Sundararajan

Hi Kelly,

U can make use of the server variables available.
Request.ServerVariables("LOGON_USER") will help u to capture the logged in
user.

Hope this helps.

Regards,
Sundararajan.S
 
M

Mythran

Sundararajan said:
Hi Kelly,

U can make use of the server variables available.
Request.ServerVariables("LOGON_USER") will help u to capture the logged in
user.

If you are using Windows Integrated security, use the following snip:

Dim userId As String = HttpContext.Current.User.Identity.Name

Try that out and see if it works for you :)

Mythran
 
K

Kelly

Hi there, I tried this method as well and it didn't work for me. :( Thanks
for your help though!
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top