Hello,
I have created a new website using Visual Studio 2010 using MVC3 Razor Template "ASP.NET Web Site (Razor)" with Membership Provider;
on my local pc I have SqlExpress and it work fine with .mdf database, but my remote site NOT have SqlExpress on www server, so I use a MSSQL2008server database where I create all table present on StarterSite.mdf file; after that I change web.config file from:
I publish them and it seems work but when I try to register a new user I got this Error:
Server Error in '/Web' Application.
--------------------------------------------------------------------------------
To call this method, the "Membership.Provider" property must be an instance of "ExtendedMembershipProvider".
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: To call this method, the "Membership.Provider" property must be an instance of "ExtendedMembershipProvider".
Source Error:
Line 61: try {
Line 62: bool requireEmailConfirmation = !WebMail.SmtpServer.IsEmpty();
Line 63: var token = WebSecurity.CreateAccount(email, password, requireEmailConfirmation);
Line 64: if (requireEmailConfirmation) {
Line 65: var hostUrl = Request.Url.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped);
Source File: Account\Register.cshtml Line: 63
Stack Trace:
[InvalidOperationException: To call this method, the "Membership.Provider" property must be an instance of "ExtendedMembershipProvider".]
WebMatrix.WebData.WebSecurity.VerifyProvider() +46561
WebMatrix.WebData.WebSecurity.CreateAccount(String userName, String password, Boolean requireConfirmationToken) +13
ASP._Page_Account_Register_cshtml.Execute() in Account\Register.cshtml:63
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(HttpContext context) +249
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
do you know the way to
solvethis problem?
thanks and regards
antony.kll
5 Posts
MSSQL2008 DB instead of mdf file on MVC3 Membership Provider website
Aug 31, 2011 04:28 PM|LINK
Hello,
I have created a new website using Visual Studio 2010 using MVC3 Razor Template "ASP.NET Web Site (Razor)" with Membership Provider;
on my local pc I have SqlExpress and it work fine with .mdf database, but my remote site NOT have SqlExpress on www server, so I use a MSSQL2008server database where I create all table present on StarterSite.mdf file; after that I change web.config file from:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<connectionStrings>
<add name="StarterSite" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\StarterSite.mdf;User instance=true" providerName="System.Data.SqlClient"/>
</connectionStrings>
</configuration>
to use MSSQL2008DB instead of file StarterSite.mdf and I add also default membership provider:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="StarterSite" connectionString="Data Source=<mydbip>;Connection Timeout=0;Packet Size=4096;Integrated Security=no;User ID=<mydbid>;Encrypt=no;pwd=<mydbpwd>;" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15">
<providers>
<clear />
<add
name="SqlProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="StarterSite"
applicationName="WebSite"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
requiresUniqueEmail="true"
passwordFormat="Hashed"
/>
</providers>
</membership>
</system.web>
</configuration>
I publish them and it seems work but when I try to register a new user I got this Error:
Server Error in '/Web' Application.
--------------------------------------------------------------------------------
To call this method, the "Membership.Provider" property must be an instance of "ExtendedMembershipProvider".
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: To call this method, the "Membership.Provider" property must be an instance of "ExtendedMembershipProvider".
Source Error:
Line 61: try {
Line 62: bool requireEmailConfirmation = !WebMail.SmtpServer.IsEmpty();
Line 63: var token = WebSecurity.CreateAccount(email, password, requireEmailConfirmation);
Line 64: if (requireEmailConfirmation) {
Line 65: var hostUrl = Request.Url.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped);
Source File: Account\Register.cshtml Line: 63
Stack Trace:
[InvalidOperationException: To call this method, the "Membership.Provider" property must be an instance of "ExtendedMembershipProvider".]
WebMatrix.WebData.WebSecurity.VerifyProvider() +46561
WebMatrix.WebData.WebSecurity.CreateAccount(String userName, String password, Boolean requireConfirmationToken) +13
ASP._Page_Account_Register_cshtml.Execute() in Account\Register.cshtml:63
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(HttpContext context) +249
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
do you know the way to solve this problem?
thanks and regards
jeff@zina.co...
3379 Posts
MVP
Moderator
Re: MSSQL2008 DB instead of mdf file on MVC3 Membership Provider website
Aug 31, 2011 07:37 PM|LINK
Start with: http://weblogs.asp.net/scottgu/archive/2005/08/25/423703.aspx
Jeff
HCamper
8048 Posts
Re: MSSQL2008 DB instead of mdf file on MVC3 Membership Provider website
Sep 26, 2011 01:35 PM|LINK
Hello,
I agree with Jeff scottgu Blog "Scott Guthrie"
http://weblogs.asp.net/scottgu/archive/2005/08/25/423703.aspx
SQL Server MVC3 and more.
Regards,
Martin
Community Member Award 2011
HCamper
8048 Posts
Re: MSSQL2008 DB instead of mdf file on MVC3 Membership Provider website
Feb 03, 2012 05:22 PM|LINK
Hello,
DId you check Jeffs suggestion ?
Feel free to ask more questions.
Have you Enabled FRT logging can you can post logs and information to be checked.
Regards,
Martin
Community Member Award 2011