I am trying to authenticate through WebSecurity class.
I have a form and when a user submits this is called:
@{
if(IsPost) {
var username = Request["username"];
var password = Request["password"];
WebSecurity.CreateAccount(username, password, false);
WebSecurity.Login(username, password);
Response.Redirect("Default.cshtml");
}
}
I already call:
WebSecurity.InitializeDatabaseConnection("Veidibok", "UserProfile", "UserId", "Email", true);
in my _appStart.cshtml file.
I get this error from the CreateAccount()
call:
[MembershipCreateUserException: The Provider encountered an unknown error.]
WebMatrix.WebData.SimpleMembershipProvider.CreateAccount(String userName, String password, Boolean requireConfirmationToken) +1312
WebMatrix.WebData.WebSecurity.CreateAccount(String userName, String password, Boolean requireConfirmationToken) +31
ASP._Page_Authentication_Register_cshtml.Execute() in c:\Users\Notandi\Documents\My Web Sites\VeidiBok\Authentication\Register.cshtml:6
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +207
System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors) +68 System.Web.WebPages.WebPage.ExecutePageHierarchy() +156 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +76
System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContextBase httpContext) +119
So anyone have any ideas? I'm really new at this, just trying out WebMatrix and .cshtml