WebSecurity.CreateAccount fails for MySQL

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 08:28:48

问题


I am using WebMatrix and stuck at the first place while trying to create users in MySQL database.

The error message is in line:

var token = WebSecurity.CreateAccount(email, password, requireEmailConfirmation);

Error message:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[UserId] FROM [UserProfile] WHERE (UPPER([Email]) = 'TE3ST@TEST.DE')'

I can fully understand that the server is trying to use SQL formatted query to MySQL server. How do I recompile or tell the WebSecurity.CreateAccount to use MySQL formatted queries?

Any idea?

Thank you in advance krish


回答1:


The WebSecurity helper is a wrapper around the SimpleMembership Provider which doesn't support MySQL (at the moment, at least). It only supports SQL Server and SQL Compact 4.0. You can write your own membership provider which inherits ExtendedMembershipProvider if you need MySQL support.



来源:https://stackoverflow.com/questions/14770637/websecurity-createaccount-fails-for-mysql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!