helpsos
شنبه 08 آذر 1393, 11:26 صبح
سلام به همه
این رو می دونیم که در زمان کار با ASP.NET Identity 2+ می توانیم فیلدهای دیگه ای رو به جدول کاربران اضافه کنیم:
public class ApplicationUser : IdentityUser//: IdentityUser
{
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
{
// Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
// Add custom user claims here
return userIdentity;
}
//اضافه کردن فیلدهای دلخواه برای جدول کاربران
public string NikName { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Picture { get; set; }
}
و این رو هم می دونیم که با نوشتن دستور زیر می توانیم نام کاربری فرد لاگین کرده را به دست بیاریم:
User.Identity.Name
حالا سوال من اینه که چطوری میشه وقتی از دستور بالا که نام کاربری رو میده استفاده می کنیم به جای نام کاربری نام مستعار (NikName) رو نشون بده مثل سایت www.dotnettips.info (http://www.dotnettips.info)
با تشکر از شما متخصصان
این رو می دونیم که در زمان کار با ASP.NET Identity 2+ می توانیم فیلدهای دیگه ای رو به جدول کاربران اضافه کنیم:
public class ApplicationUser : IdentityUser//: IdentityUser
{
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
{
// Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
// Add custom user claims here
return userIdentity;
}
//اضافه کردن فیلدهای دلخواه برای جدول کاربران
public string NikName { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Picture { get; set; }
}
و این رو هم می دونیم که با نوشتن دستور زیر می توانیم نام کاربری فرد لاگین کرده را به دست بیاریم:
User.Identity.Name
حالا سوال من اینه که چطوری میشه وقتی از دستور بالا که نام کاربری رو میده استفاده می کنیم به جای نام کاربری نام مستعار (NikName) رو نشون بده مثل سایت www.dotnettips.info (http://www.dotnettips.info)
با تشکر از شما متخصصان