Connect ASP.NET MVC4 site to SQLite (Membership, roles, profiles, sessions, etc...) model
Connect ASP.NET MVC4 site to SQLite (Membership, roles, profiles, sessions, etc...) model
I'm new, Sorry if this is redundant question, does someone know how to link an ASP.NET MVC4 site to SQLite (Membership, roles, profiles, sessions, etc...)
Here is the starting point :
1) Start VS2012
2) New project ... "ASP.NET MVC4 Web Application"
3) WEB Application (Razor)
Need to switch database to SQLite? I've tried the instruction on the ASP.NET Provider Model Support page here http://www.devart.com/dotconnect/sqlite/docs/ but I can't get it to work.
Here is the starting point :
1) Start VS2012
2) New project ... "ASP.NET MVC4 Web Application"
3) WEB Application (Razor)
Need to switch database to SQLite? I've tried the instruction on the ASP.NET Provider Model Support page here http://www.devart.com/dotconnect/sqlite/docs/ but I can't get it to work.
Re: Connect ASP.NET MVC4 site to SQLite (Membership, roles, profiles, sessions, etc...) model
The situation with the SimpleMembership support in dotConnect providers is described at http://forums.devart.com/viewtopic.php?f=2&t=24826. We will post here when the corresponding functionality is implemented in dotConnect for SQLite.
Re: Connect ASP.NET MVC4 site to SQLite (Membership, roles, profiles, sessions, etc...) model
New version of dotConnect for SQLite 4.5 is released!
It can be downloaded from http://www.devart.com/dotconnect/sqlite/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=29&t=26104.
This build includes the ExtendedMembership (SimpleMembership) provider support: http://www.devart.com/dotconnect/sqlite ... orial.html.
It can be downloaded from http://www.devart.com/dotconnect/sqlite/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=29&t=26104.
This build includes the ExtendedMembership (SimpleMembership) provider support: http://www.devart.com/dotconnect/sqlite ... orial.html.
Re: Connect ASP.NET MVC4 site to SQLite (Membership, roles, profiles, sessions, etc...) model
Shalex Thanks... I followed the MVC4 example and was able to make everything work with the latest code.
Unfortunately I can't get the ASP.NET Website configuration tool to work with the new database! In VS2012 Click on Project and select ASP.NET Configuration. If I can't configure the secure database it's not much use.
My company has purchased Devart SQLite 4.5 That is what I'm using.
Unfortunately I can't get the ASP.NET Website configuration tool to work with the new database! In VS2012 Click on Project and select ASP.NET Configuration. If I can't configure the secure database it's not much use.
My company has purchased Devart SQLite 4.5 That is what I'm using.
Re: Connect ASP.NET MVC4 site to SQLite (Membership, roles, profiles, sessions, etc...) model
Please disregard the last post I found my answer here: http://weblogs.asp.net/jgalloway/archiv ... lates.aspx
Re: Connect ASP.NET MVC4 site to SQLite (Membership, roles, profiles, sessions, etc...) model
Could someone point me to a way of using the Roles and membership API
<membership defaultProvider="SQLiteExtendedMembershipProvider"/>
<roleManager enabled="true" defaultProvider="SQLiteExtendedRoleProvider"/>
This doesn't work...
var roles = (SQLiteExtendedRoleProvider)Roles.Provider;
var membership = (SQLiteExtendedMembershipProvider)Membership.Provider;
in fact I can't find any SQLiteExtendedRoleProvider or SQLiteExtendedMembershipProvider in the Devart tools. Am I missing something?
<membership defaultProvider="SQLiteExtendedMembershipProvider"/>
<roleManager enabled="true" defaultProvider="SQLiteExtendedRoleProvider"/>
This doesn't work...
var roles = (SQLiteExtendedRoleProvider)Roles.Provider;
var membership = (SQLiteExtendedMembershipProvider)Membership.Provider;
in fact I can't find any SQLiteExtendedRoleProvider or SQLiteExtendedMembershipProvider in the Devart tools. Am I missing something?
Re: Connect ASP.NET MVC4 site to SQLite (Membership, roles, profiles, sessions, etc...) model
Here's the work around for
This doesn't work...
var roles = (SQLiteExtendedRoleProvider)Roles.Provider;
var membership = (SQLiteExtendedMembershipProvider)Membership.Provider;
This works ...
var roles = System.Web.Security.Roles.GetRolesForUser();
var membership = System.Web.Security.Membership.GetUser();
This doesn't work...
var roles = (SQLiteExtendedRoleProvider)Roles.Provider;
var membership = (SQLiteExtendedMembershipProvider)Membership.Provider;
This works ...
var roles = System.Web.Security.Roles.GetRolesForUser();
var membership = System.Web.Security.Membership.GetUser();
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Connect ASP.NET MVC4 site to SQLite (Membership, roles, profiles, sessions, etc...) model
System.Web.Security.Membership and System.Web.Security.Roles are static classes for ASP.NET 2.0 providers.acooper wrote:This works ...
var roles = System.Web.Security.Roles.GetRolesForUser();
var membership = System.Web.Security.Membership.GetUser();
To work with SQLiteExtendedMembershipProvider you should use the WebMatrix.WebData.WebSecurity static class. To work with SqlLiteExtendedRoleProvider, System.Web.Security.Roles is used.
You can also use the approach you've described:
What exactly does not work? In our environment everything works fine. If possible, please create and send us a small test project and describe the steps for reproducing the issue.acooper wrote: This doesn't work...
var roles = (SQLiteExtendedRoleProvider)Roles.Provider;
var membership = (SQLiteExtendedMembershipProvider)Membership.Provider;
Probably, you tried to use methods defined in the MembershipProvider class for the membership variable having the SQLiteExtendedMembershipProvider type. The fact is that ExtendedMembershipProvider inherits from the MembershipProvider class, but SQLiteExtendedMembershipProvider does not implement methods inherited from MembershipProvider.
For more information, please refer to http://msdn.microsoft.com/en-us/library ... 11%29.aspx
Re: Connect ASP.NET MVC4 site to SQLite (Membership, roles, profiles, sessions, etc...) model
I tried to upload a project... it was just your tutorial created in VS2012 unfortunately even in the zipped up it was 6mb which exceeds your 2mb limit.
Here is my specific problem. I have dcsqlite45pro.exe purchased version.
The version I just downloaded and installed has
Devart.Data.SQLite.Web.Providers.SQLiteMembershipProvider
Devart.Data.SQLite.Web.Providers.SQLiteRolesProvider
but does not have
Devart.Data.SQLite.Web.Providers.SQLiteExtendedMembershipProvider
Devart.Data.SQLite.Web.Providers.SQLiteExtendedRolesProvider
Here is my specific problem. I have dcsqlite45pro.exe purchased version.
The version I just downloaded and installed has
Devart.Data.SQLite.Web.Providers.SQLiteMembershipProvider
Devart.Data.SQLite.Web.Providers.SQLiteRolesProvider
but does not have
Devart.Data.SQLite.Web.Providers.SQLiteExtendedMembershipProvider
Devart.Data.SQLite.Web.Providers.SQLiteExtendedRolesProvider
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Connect ASP.NET MVC4 site to SQLite (Membership, roles, profiles, sessions, etc...) model
dotConnect for SQLite has two Devart.Data.SQLite.Web.dll assemblies. One assembly has version 4.5.202.0 and is intended for ASP.NET 2.0. This assembly is placed in GAC and it is likely that you attached this very assembly to your project.
Devart.Data.SQLite.Web.dll assembly version 4.5.202.0 has no SQLiteExtendedMembershipProvider and SQLiteExtendedRolesProvider classes.
There is also Devart.Data.SQLite.Web.dll assembly version 4.5.202.4 located in the %Program Files%\DevartDevart\dotConnect\SQLite\NET4 folder. This assembly is intended for work with .NET Framework 4 and this is the assembly that has to be added to your project. In Visual Studio 2012 the reference to the assembly of this version can be added only via the 'Browse' option of the 'Reference Manager' dialog box.
We have added the Devart.Data.SQLite.Web.dll assembly version 4.5.202.4 to the GAC and starting from the next public build there will be both versions of the Devart.Data.SQLite.Web.dll assembly in the GAC.
You may also find useful the following information http://www.devart.com/dotconnect/sqlite ... orial.html
Devart.Data.SQLite.Web.dll assembly version 4.5.202.0 has no SQLiteExtendedMembershipProvider and SQLiteExtendedRolesProvider classes.
There is also Devart.Data.SQLite.Web.dll assembly version 4.5.202.4 located in the %Program Files%\DevartDevart\dotConnect\SQLite\NET4 folder. This assembly is intended for work with .NET Framework 4 and this is the assembly that has to be added to your project. In Visual Studio 2012 the reference to the assembly of this version can be added only via the 'Browse' option of the 'Reference Manager' dialog box.
We have added the Devart.Data.SQLite.Web.dll assembly version 4.5.202.4 to the GAC and starting from the next public build there will be both versions of the Devart.Data.SQLite.Web.dll assembly in the GAC.
You may also find useful the following information http://www.devart.com/dotconnect/sqlite ... orial.html
Re: Connect ASP.NET MVC4 site to SQLite (Membership, roles, profiles, sessions, etc...) model
Thanks, now ever thing is working on the localhost!
But my server throws this error:
Parser Error Message: Default Role Provider could not be found.
Source Error:
Line 29: <customErrors mode="Off" />
Line 30: <membership defaultProvider="SQLiteExtendedMembershipProvider" />
Line 31: <roleManager enabled="true" defaultProvider="SQLiteExtendedRoleProvider" />
Line 32:
Line 33: <compilation targetFramework="4.5"><assemblies><add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /></assemblies></compilation>
But my server throws this error:
Parser Error Message: Default Role Provider could not be found.
Source Error:
Line 29: <customErrors mode="Off" />
Line 30: <membership defaultProvider="SQLiteExtendedMembershipProvider" />
Line 31: <roleManager enabled="true" defaultProvider="SQLiteExtendedRoleProvider" />
Line 32:
Line 33: <compilation targetFramework="4.5"><assemblies><add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /></assemblies></compilation>
Re: Connect ASP.NET MVC4 site to SQLite (Membership, roles, profiles, sessions, etc...) model
I have compiled the Licenses and placed the dll in the bin. Devart.Data.dll, Devart.Data.SQLite.dll and Devart.Data.SQLite.Web.dll are all in the bin and everything is where it should be on the server. If I comment out <roleManager enabled="true" defaultProvider="SQLiteExtendedRoleProvider" /> then the website will run, but it crashes as soon as I try to access the database.
Re: Connect ASP.NET MVC4 site to SQLite (Membership, roles, profiles, sessions, etc...) model
I think this might be the problem...
I'm publishing the website using VS2012 Web Deploy. During the publishing I get a message (see jpg attached) "The provider of this Database Devart.Data.SQLite is not supported for publishing".
The Server now give me this error:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
I'm publishing the website using VS2012 Web Deploy. During the publishing I get a message (see jpg attached) "The provider of this Database Devart.Data.SQLite is not supported for publishing".
The Server now give me this error:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Connect ASP.NET MVC4 site to SQLite (Membership, roles, profiles, sessions, etc...) model
When you install dotConnect for SQLite on your computer, the SQLiteExtendedMembershipProvider and SQLiteExtendedRoleProvider providers are registered in the machine.config file. Then in the web.config file of your application, specify that SQLiteExtendedMembershipProvider and SQLiteExtendedRoleProvider described in the machine.config file should be used.
When you deploy your application on the web server, the machine.config file of the web server has no records defining SQLiteExtendedMembershipProvider and SQLiteExtendedRoleProvider. This issue can be solved the following way.
Add SQLiteExtendedMembershipProvider and SQLiteExtendedRoleProvider in your web.config file. Replace this record in the web.config file:
With this one:
When you deploy your application on the web server, the machine.config file of the web server has no records defining SQLiteExtendedMembershipProvider and SQLiteExtendedRoleProvider. This issue can be solved the following way.
Add SQLiteExtendedMembershipProvider and SQLiteExtendedRoleProvider in your web.config file. Replace this record in the web.config file:
Code: Select all
<membership defaultProvider="SQLiteExtendedMembershipProvider" />
<roleManager enabled="true" defaultProvider="SQLiteExtendedRoleProvider" />
Code: Select all
<roleManager enabled="true" defaultProvider="SQLiteExtendedRoleProvider">
<providers>
<add name="SQLiteExtendedRoleProvider" type="Devart.Data.SQLite.Web.Providers.SQLiteExtendedRoleProvider,
Devart.Data.SQLite.Web, Version=4.5.202.4, Culture=neutral, PublicKeyToken=09af7300eec23701"
description="dotConnect for SQLite extended role provider"
connectionStringName="SQLiteServices" useridcolumn="UserId"
usernamecolumn="UserName" usertablename="UserProfile" />
</providers>
</roleManager>
<membership defaultProvider="SQLiteExtendedMembershipProvider">
<providers>
<add name="SQLiteExtendedMembershipProvider"
type="Devart.Data.SQLite.Web.Providers.SQLiteExtendedMembershipProvider, Devart.Data.SQLite.Web,
Version=4.5.202.4, Culture=neutral, PublicKeyToken=09af7300eec23701"
description="dotConnect for SQLite extended membership provider"
connectionStringName="SQLiteServices" useridcolumn="UserId"
usernamecolumn="UserName" usertablename="UserProfile" />
</providers>
</membership>
Publish Web Application supports only the SQL Server database.acooper wrote:I'm publishing the website using VS2012 Web Deploy. During the publishing I get a message (see jpg attached) "The provider of this Database Devart.Data.SQLite is not supported for publishing".
Re: Connect ASP.NET MVC4 site to SQLite (Membership, roles, profiles, sessions, etc...) model
I already tried that 2 days ago! In fact your code is missing
<remove name="SQLiteExtendedMembershipProvider"/> and <remove name="SQLiteExtendedRoleProvider"/> !
What do you mean... Web publishing only supports SQL server? I'm using MSDeploy to manually deploy my app to a local server. Does that mean if I use MSDeploy your assembly's won't work?
<remove name="SQLiteExtendedMembershipProvider"/> and <remove name="SQLiteExtendedRoleProvider"/> !
What do you mean... Web publishing only supports SQL server? I'm using MSDeploy to manually deploy my app to a local server. Does that mean if I use MSDeploy your assembly's won't work?