我已经添加了以下属性来我ApplicationUser类:如何以asp.net身份更改我的欢迎消息?
public class ApplicationUser : IdentityUser
{
public string FirstName { get; set; }
public string LastName { get; set; }
// if true, user will be subscribed to the Newsletter
public bool Newsletter { get; set; }
}
我明明_LoginPartial页面不知道这个尚未从IdentityExtensions获取数据:
@Html.ActionLink("Welcome back " + User.Identity.GetUserName() + "!", "Index", "Manage", routeValues: null, htmlAttributes: new { title = "Manage" })
的GetUserName()
功能返回电子邮件地址。我宁愿返回String.Format(“{0} {1}”,名字,姓氏)
我只是不知道如何扩展IdentityExtensions类,以添加一个函数,返回值想在这里。
我从哪里开始?
我知道'User.Identity.Name',你有没有尝试,如果它适用于第一至少命名? –