1
當我設置這樣的ASP MVC如何創建自定義FormsAuthentication.SetAuthCookie?
FormsAuthentication.SetAuthCookie(model.UserName, true);
的AuthCookie的model.userName實際上是用戶的電子郵件這就是唯一識別每個用戶,然後在我看來,當我使用:
Welcome <strong> @User.Identity.Name</strong>!
它顯示「歡迎use[email protected] !,但我想用戶user.firstname。
所以,我的問題是,是否有可能實現自定義User.Identity或自定義Forms.SetAuthCookie,這將允許我使用這樣的東西o我的看法:
Welcome <strong> @User.Identity.FirstName</strong>!