c# - How to change the greeting message on ASP.Net from UserName to First Name or any other field? -
how can change below mentioned code show: hello "first name" instead of hello "username".
i have created custom fields inside identity user table such "firstname","middlename","lastname".
below mentioned code inside site.master.
<li>   <a runat="server" href="~/account/manage" title="manage account">      hello, <%: context.user.identity.getusername()  %> !   </a> </li> i appreciate efforts in reaching solution problem.
first add microsoft.aspnet.identity.owin namespace in web.config
<configuration>    <namespaces>        <!-- other namespaces -->        <add namespace="microsoft.aspnet.identity.owin"/>   </namespaces> </configuration> then replace code with:
<li>     <a runat="server" href="~/account/manage" title="manage account"> hello,         <%: httpcontext.current.getowincontext()             .getusermanager<yournamespace.applicationusermanager>()             .findbyid(context.user.identity.getuserid()).firstname %>!    </a> </li> 
Comments
Post a Comment