0
votes

I am trying to use ASP.NET membership in an ASP.NET project. The only requirement I have is that users will need to login using an EmployeeID as the username instead of the Email. Is this something easily configurable using the default membership provider?

I see a MobilePin column inside the aspnet_Membership table and I am wondering if there is a way to use that as the username instead.

Thanks

1

1 Answers

0
votes

You can roll your own membership provider and check the DB with the provided values. Since you likely already have a LogonModel that uses the UserName attribute you can change that to EmployeeId instead. You may also have to re-generate the Logon view with the altered property.

So instead of a view with

        @Html.TextBoxFor(m => m.UserName)

It will be something like

        @Html.TextBoxFor(m => m.EmployeeId)

Whatever you renamed your Logon model class to have.

Then you will need to have your own MembershipProvider and override the ValidateUser method so that it validates against the DB. Then in your controller method for the HttpPost action use your membership provider implementation.

That is unless you are hoping to authenticate against the Domain, in which case see the following link

http://msdn.microsoft.com/en-us/library/ff650308.aspx