get User ID from current user

hi, 
i'm trying to log database activity. therefore i need the user-id of the currently logged-in user.
For the login i used the login-controls that come with VWD and set up a MS SQL Server 2000 Database for data storage. That part works fine, but i've found no way to get the id.

i'd be glad for some hints.

Thx, Sönke


P.S.:
found things linke user.identity.name and membershipuser.providerkey (or sth) - but this didn't help me.

0
Schlaubi1980
3/27/2006 2:42:06 PM
asp.net.security 27051 articles. 1 followers. Follow

3 Replies
2243 Views

Similar Articles

[PageSpeed] 56

Are you aware of where the users are stored in the database?  Did you configure the personalization providers from the default?  If not, open up ASPNETDB.MDF and get a feel for how and where user info is stored.  

You could get this information by using something like this probably but you would need to pass the value of @UserName in somehow like from a login text box or a drop down list depending on your application

SELECT [UserID] [UserName] FROM [vw_aspnet_Users] WHERE [UserName] = @UserName

Let me know if this helps
0
ptleitch
3/27/2006 6:22:01 PM
MembershipUser mu = Membership.GetUser();

string userName = mu.name or mu.provideUserKey

Peter Kellner
http://73rdstreet.com and blogging at
http://PeterKellner.net
MVP, ASP.NET
0
pkellner
3/27/2006 6:23:16 PM
@pkellner
hi - thanks a lot. exactly what i needed.

@ptleitch
like i said - i'm well aware of the underlying database and its structure - but i'm using a set up MS SQL 2000 instead of the 2005 Express.


Maybe you could help me with a related topic.

I need to built an external Program (think it will be Delphi-built) that can verify users. Due to the Password encryption of asp.net i can't match the username and password without the encryption-algorithm.

I read somewhere about switching off the encryption via the Membership-Provider. But is there no other way without reducing security?

Some of your ideas could help me.

Thanks in advance
Sönke
0
Schlaubi1980
3/28/2006 6:59:38 AM
Reply: