473,320 Members | 1,744 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Current userid

How can you capture the current User ID that just logged in? I am using the following to get the current user id

WindowsPrincipal wpUser = new WindowsPrincipal( WindowsIdentity.GetCurrent() );

return wpUser.Identity.Name;


When this runs from a service, it returns the account that is running the service. Any insight would be helpful?

Thanks,
Apr 6 '07 #1
2 1046
kenobewan
4,871 Expert 4TB
This will depend on how the userid was allocated. Please provide more info. Thanks.
Apr 8 '07 #2
DataAdapter da =new DataAdapter();
DataSet ds = new DataSet();
da.FillbyUserID(ds, ConvertInto32(Session["CurrentUserID"].ToString()));
ds.UserRow urow = (ds.UserRow) ds.User.Row[0];
string Username = urow.username.ToString();

lblUser.Text = Username;
Apr 9 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Trint Smith | last post by:
I did have UserID as 'Dim UserID As String'. Ok, when I made it 'Public UserID As String', in the Public Area of one program and took out all the 'local' declairations of it, even in the other...
1
by: VB Programmer | last post by:
When my users login I want them to be able to change some of their personal info in a db. I want to use a detailsview control for this. How can I get the detailsview to only pull up the record...
11
by: jd_12345 | last post by:
On DB2 on AIX, I'm attempting to retrieve the most recent ID for each unique Code based on its EffectiveDate. For example, in the data below, I want to retrieve ID BE0191026 as it has the most...
2
by: Ray Booysen | last post by:
Hi all I'm wanting to know if its possible to retrieve the current user when using the 2.0 membership provider. The GUID UserID in Users I am using as a foreign key in other tables and I need...
0
by: ArvisLT | last post by:
Hi, I'm trying to make SQL query which selects data dependent on current ASP user and his being in user groups. I have tables: AspNet_Users – contains UserName and UserID columns AspNet_Roles –...
1
parshupooja
by: parshupooja | last post by:
Hi , I have asp.net page. I have few fields on page , I am inserting value into this fields which are getting saved into SQL server database. I have additional column into the table(SQL Server)...
3
by: Jim | last post by:
Using either EW or VSE2008, I want to have a GridView that will: - Insert the logged in user's UserId from either the User table or the membership table when the user inserts a record. - When the...
4
by: sjohnson1984 | last post by:
Hello all, I have a form which is generated using a database query - the recordset is filled with agent details, login time and the like, and there are as many rows in the table as records in the...
0
by: Peter | last post by:
How do I get current user Network ID on Intranet from ASP.NET web page? the following works on my computer, but I get blank userID when the website is on the test web server. ...
0
by: =?Utf-8?B?QW50b25pbyBPJydOZWFs?= | last post by:
We changed a username in AD. The user now logs on to a computer on our network using the new username without any problems. They can not logon using the old username. However, when they access a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.