ASP.NET Identity for WebForms - getting started with extending User attributes -
i'm working on first asp.net webforms project using identity. ticked box when creating project , basics seem working ok. want extend register form , aspnetusers table new attributes (e.g. users (actual) name). i'd expose existing phonenumber attribute.
i did research couldn't find non-mvc info on scenario. expectation hack away @ template code achieve this?
i'm happy so, wondering if missing something...
as using asp.net web default files , folders. please open identitymode.cs in models folder , find applicationuser class. in class can add user attributes properties, see example : 01: add profile information in users table:
public class applicationuser : identityuser { [required] public string userfullname { get; set; } [required] public string email { get; set; } [required] public string phonenumber { get; set; } [required] public string address { get; set; } public datetime registereddate { get; set; } public string info { get; set; } }
02 : can add profile information in different table :
public class applicationuser : identityuser { public virtual userinfo userinfo { get; set; } } public class userinfo { [required] public string userfullname { get; set; } [required] public string email { get; set; } [required] public string phonenumber { get; set; } [required] public string address { get; set; } public datetime registereddate { get; set; } public string info { get; set; } }
Comments
Post a Comment