Last post Jul 31, 2013 03:46 AM by vinlap
Jul 30, 2013 02:08 PM|vinlap|LINK
I'm new into Internet development, but I want to write an Internet site. I use ASP.NET 4.5 and I can't use SQL server database, but only an old Access database (*.mdb).
I have set the connection string into the web.config file like this for my local site :
<add name="ConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Laportes.mdb;Persist Security Info=True"
It works good to access the data with the listview, ... The problem is with the login (asp:CreateUserWizard). I put the new next lines into the Web.config file to use the Form authentication :
<system.web> <authentication mode="Forms">
<forms loginUrl="/Account/Connexion.aspx" requireSSL="false" defaultUrl="~/" />
It works good, but the problem is it create an ASPNETDB.MDF file into my App_Data directory... I try to add this lines to tell to IIS to use my connection string and customize the login controls :
<add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=22.214.171.124, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="ConnectionString" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
But I have an error :
Could not load file or assembly 'System.Web.Providers, Version=126.96.36.199, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
I remove the membership marker, and I had installed the Microsoft AspNet Provider (install-package System.Web.Providers into the NuGet console) but I doesn't works. I've got :
get_ProviderFactory' get Null on a store provider instance of type 'System.Data.OleDb.OleDbConnection'. You may store provider malfunction.
I imagine this is because the Microsoft provider is written to use MS SQL...
So, what can we do to use an Access database to use the login capacities of the ASP.Net ?
Jul 30, 2013 02:15 PM|AidyF|LINK
The membership provider that comes with it doesn't work with Access, you need to use SQL or the SQL Express thing which the MDF file is. You need a provider that works with Access. There are probably a few out there, but here is the code for one
Jul 30, 2013 07:49 PM|hans_v|LINK
Using the Microsoft Access Providers for Membership, Roles and Profile under ASP.NET 4
But instead of a membership provider, you can just use Forms Authentication:
How to: Implement Simple Forms Authentication
Jul 31, 2013 12:03 AM|zinksoft.net|LINK
Sample Membership Provider Implementation:
just do some modify on the code to use ms access. my website also using the similar logic with ms access and lot of custom setting at the web.config, can not using the default provider.
Jul 31, 2013 03:46 AM|vinlap|LINK
Thank you for all your answers.