I am using an email address as my "username" for Login. When a user logs in the User object that is created has the Email address as the name which is incorrect. The actual name is another field in the DB. How do I login and authenticate against the email address and then load the correct name in the User object?
I am using forms authentication with a custom MembershipProvider and RoleProvider.
Edits Below to Clarify
I have a custom MembershipProvider that validates users by email address and password. It is called by the basic Login Control and registered in web.config.
<asp:Login ID="AdminLogin" runat="server" MembershipProvider="AdminMembershipProvider">
</asp:Login>
Web.Config:
<authentication mode="Forms">
<forms loginUrl="Default.aspx" />
</authentication>
<membership defaultProvider="AdminMembershipProvider">
<providers>
<clear />
<add name="AdminMembershipProvider"
type="AdminMembershipProvider"
connectionStringName="EvalSysConnectionString"
/>
</providers>
</membership>
With just this my users are logged in correctly. However it returns a Context.User.Identity.Name of the email address. I have the first name and last name stored in the DB and want this to be the Name.
I read various posts that seem to indicate that I would have to create a Global.asax file and override the PostAutheticateRequest method to do this. However I have no idea how to proceed with this strategy.
<%@ Application Language="C#" %>
<script runat="server">
protected void Application_PostAuthenticateRequest()
{
string test = HttpContext.Current.User.ToString();
}
</script>
I'm sorry my question was so vague. I'm so lost with this that I don't know how to write a good question.