简体   繁体   English

在ASP.NET中获取已登录用户的userID

[英]Getting the userID of a logged in User in ASP.NET

How can I get the exact ID of a user that is logged into a site? 如何获得登录到站点的用户的确切ID?

I'm using the login and registration controls created by Visual Studio 2010, in the database the unique identifier is in this 28e8957e-00b8-4e75-bec9-2b90e640962d for example how can I return the exact one to be used in an SQL command for example? 我使用的是Visual Studio 2010创建的登录和注册控件,数据库中的唯一标识符位于此28e8957e-00b8-4e75-bec9-2b90e640962d ,例如,如何返回用于SQL命令的确切标识符例?

Use 采用

using System.Web.Security;

Membership.GetUser(HttpContext.Current.User.Identity.Name).ProviderUserKey;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM