display email of logged in user, aspnet forms authentication
i'm using forms based authentication within my aspnet (c#) website. At the log in page i'm capturing username, password and email. the email addressed is stored wit开发者_C百科hin the membership table. now on a new page, i'd just like to display the users' email address so they update it as well as another boolean field. i've tried using a gridview but i can't figure out how to modify the query so it only reveals the current logged in user. thanks!
Since you're using Membership controls, you could to this.
string userEmail = Membership.GetUser().Email;
If you don't pass a parameter to GetUser()
, it will find the details of the currently logged in user.
MSDN doc for Email property
MSDN doc for GetUser method
精彩评论