Skip to main content


Showing posts from August, 2012

Razor Application Authentication change from email to username

ASP.Net Web Pages - Razor (v2) makes it easy enough to switch from email based authentication to username based login. I have added some of the major as well as minimum updates that are needed to update the registration process as well as the login process, to enable the application to utilize the username rather than the email for authentication. Database Update: UserProfile: Add a new database table column called “UserName” under the table UserProfile of the razor (v2) application. --------------------------------------- Page Update: ~/_AppStart.cshtml: WebSecurity.InitializeDatabaseConnection("myConnectionString", "UserProfile", "UserId", "UserName", autoCreateTables: true); --------------------------------------- Page Update: ~/Account/Register.cshtml: Add variable under initialize variables: var userName = ""; Add setup validation: Validation.RequireField("userName", "You must specify user name."); Add in IsPo