Capture user credentials

I have a VB.NET console app that will run nightly via scheduler.  Also, this exe can be initiated by a small little ASP.NET web form I created that simply has a button that fires off the exe located on our server using some code I created in my aspx.vb file using the System.Diagnostics.Process namespace

How can I capture:

1) The UserID that is set in my sheduler who runs the exe every night via the scheduled task

2) The user who clicks on my button

I need to insert this information into a trail table so I need to know how to grab this info in both cases in VB.NET v2.0 specifically...please no VB.NET v1.0 or 1.1 here.
Who is Participating?
does your site use authentication? if not then it will not be possible to capture the user as they will all be using anonymous access. If they are on a domain or logged in then something like HttpContext.Current.User.Identity.Name would get their username.
There are probably several possiblities for you

I personnally add the user name in a session from the login control

Session.Add("UserName", Login1.UserName)

this is supposed to retrieve the user name as well, you could store it in any number of ways.  this will save it as a string

dim strUserName as String = User.Identity.Name

this forum relates to your question about the user id

have you solved your problem?
dba123Author Commented:
Thanks, this is a start.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.