开发者

Membership provider name and type for Microsoft WebMatrix's sample Template

开发者 https://www.devze.com 2023-03-09 12:45 出处:网络
What is the membership provider name and type is used in the Microsoft Webmatrix\'s template site? In the web.config it is not given. When I run it locally, the template works but when I publish, it g

What is the membership provider name and type is used in the Microsoft Webmatrix's template site? In the web.config it is not given. When I run it locally, the template works but when I publish, it gives the following error:

Parser Error Message: The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty.

Source Error:

Line 239:      <providers>
Line 240:        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, .... 

Source File: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config Line: 240

Any help will be appre开发者_如何学JAVAciated.

The Database used in the application is SQLCE4.


Web Pages uses the SimpleMembershipProvider which is located in WebMatrix.WebData.


I don't believe there's a default Membership provider that supports SQL Server Compact Edition 4. There is a Membership provider implementation that does out on CodePlex: http://sqlcemembership.codeplex.com/

So, if you're using that already, then ensure that you have a connection string defined in your config file, like so:

<connectionStrings>
  <add name="LocalSqlServer" 
       connectionString="data source=|DataDirectory|\YourDatabaseName.sdf"/>
</connectionStrings>

And your provider specified in your config should define the connectionStringName attribute and reference the connection string's name defined in the <connectionStrings> block, like this:

<providers>
  <clear/>
  <add name="SqlCeMembershipProvider" 
       type="ErikEJ.SqlCeMembershipProvider" 
       connectionStringName="LocalSqlServer" 
       .... />
</providers>

A config sample is provided with that SQL CE 4 Membership provider on the main project page.

0

精彩评论

暂无评论...
验证码 换一张
取 消