离开登录页面后如何获取用户ID?

How to get User id after leave login page?

我开发asp.net Web Form应用程序使用VS2015。 我使用 asp.net 登录控件来识别用户。 用户登录并离开登录页面后如何获取userID?

假设您使用的是ASP.NET身份。您应该能够使用 this.Page.User.Identity.GetUserId() 访问经过身份验证的用户的 UserID。请务必包含 using Microsoft.AspNet.Identity;.