Hi,
I am new to .net 2
I have a web application and i used Web Site Administration Tool (from website->asp.net configuration) to define user and roles. This tool stores all information in a database it creates in sqlserver 2005 express.Thought sqlserver
express is good and all i would like those infromations to be stored in access database.
I know that this can be done by sellecting deferent providers in the provider tab of
Web Site Administration Tool but i currently i see only aspnetsqlprovider.
Does anyone know if there are any official providers for access databases?
I have found the sample access provider but it says that its unofficial and has been tested for only for visual studio 2005.
Any ideas?
The sample access provider up on MSDN is the one we recommend - even though its only a sample and not officially part of the Framework. You can compile the code though, deploy the DLL into your application's bin directory, and then configure all of the
provider based features in configuration to use that assembly.
-Stefan
----------------------------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
Sorry i am very new to .net and visual studio 2005,
I compiled the code, and the dll was produced as you said but i am having trouble on what to do next...
Where shall i put that dll? Can you give some more details?
Shall i expect to see a new entry on providers tab of the web site administration tool after that?
Sorry if thats too much to ask...
Create a subdirectory in your web application called "bin" - and drop the dll in there. Then you need to explicitly configure Membership, Role Manager, etc.. to use the Access providers instead of the SQL providers. An example of what the config snippet
looks like is shown below (you may need to change the assemblyname in the "type" attribute to match the name of your dll as well as the connection string):
I have put a file called "OdbcMembershipProvider.cs" in the App_Code directory that is an exact copy from the "Sample Membership Provider Implementation" example in the documentation.
My web.config file looks like this:
<?
xml
version="1.0"?>
<configuration
xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
When I have entered UserId and Password in the Login-Control and pushes the Log In button I got the following message:
Server Error in '/Andreas' Application.
Configuration Error
Description:
An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'SampleAccessProviders' or one of its dependencies. The system cannot find the file specified.
Source Error:
Line 28: <clear/>
Line 29: <add name="AccessMembershipProvider"
Line 30: type="Samples.AccessProviders.AccessMembershipProvider, SampleAccessProviders"
Line 31: connectionStringName="AccessFileName"
Line 32: enablePasswordRetrieval="false"
Assembly Load Trace: The following information can be helpful to determine why the assembly 'SampleAccessProviders' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
I also tried to change Line 30 to:
type="Samples.AspNet.Membership.OdbcMembershipProvider, SampleAccessProviders"
because the first lines in the file OdbcMembershipProvider.cs looks like this:
namespace Samples.AspNet.Membership
{
public sealed
class OdbcMembershipProvider :
MembershipProvider
and got the same result.
How do I know what Line 30 should look like???
I tried type="Samples.AspNet.Membership.OdbcMembershipProvider" and got the following error:
Server Error in '/Andreas' Application.
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
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.Data.Odbc.OdbcException: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Source Error:
Line 1283: else
Line 1284: {
Line 1285: throw e;
Line 1286: }
Line 1287: }
That implies something wrong with the connection string. The connection string I showed earlier is for
Access - and more specifically supports a special format that can be optionally used with the providers.
Since you are using ODBC, you need to use an ODBC connection string. There is a handy site out on the web that lists various connection string syntaxes - including ODBC:
Just browse the lefthand side of the page and select Access. You will then see an option for sample ODBC connection strings.
In your case for the "Dbq" attribute you would use the physical file path to the MDB. Something like "c:\inetpub\wwwroot\myapproot\App_Data\aspnet.mdb".
-Stefan
----------------------------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
I'm actually making a website with the same structure, and I'm new to .net too.
I created the users, and roles on sql server 2005 express, but I was not able to set the authentification with it in local. As I will not be allowed to use SqlServer on the final webserver, I'd like to use the db access to store authenticate informations.
As I'm a real noob with MS Sql Server, can you tell me how to do the back up of the existing sql db and implement it in my access db ?
Thank you, and sorry for my english, I'm a Belgian french speaking.
Hope I'll receive help, it's not easy to find documentation to use MS Access and ASP.NET authentification...
max_payne
Member
157 Points
63 Posts
how to set roles and users using ms access instead of sqk server express?
Jan 25, 2006 10:42 AM|LINK
I am new to .net 2
I have a web application and i used Web Site Administration Tool (from website->asp.net configuration) to define user and roles. This tool stores all information in a database it creates in sqlserver 2005 express.Thought sqlserver express is good and all i would like those infromations to be stored in access database.
I know that this can be done by sellecting deferent providers in the provider tab of Web Site Administration Tool but i currently i see only aspnetsqlprovider.
Does anyone know if there are any official providers for access databases?
I have found the sample access provider but it says that its unofficial and has been tested for only for visual studio 2005.
Any ideas?
Thanx in advance.
sschack
Contributor
3085 Points
617 Posts
Microsoft
Re: how to set roles and users using ms access instead of sqk server express?
Jan 26, 2006 12:36 AM|LINK
The sample access provider up on MSDN is the one we recommend - even though its only a sample and not officially part of the Framework. You can compile the code though, deploy the DLL into your application's bin directory, and then configure all of the provider based features in configuration to use that assembly.
----------------------------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
max_payne
Member
157 Points
63 Posts
Re: how to set roles and users using ms access instead of sqk server express?
Jan 26, 2006 07:19 AM|LINK
I compiled the code, and the dll was produced as you said but i am having trouble on what to do next...
Where shall i put that dll? Can you give some more details?
Shall i expect to see a new entry on providers tab of the web site administration tool after that?
Sorry if thats too much to ask...
sschack
Contributor
3085 Points
617 Posts
Microsoft
Re: how to set roles and users using ms access instead of sqk server express?
Jan 26, 2006 05:09 PM|LINK
Create a subdirectory in your web application called "bin" - and drop the dll in there. Then you need to explicitly configure Membership, Role Manager, etc.. to use the Access providers instead of the SQL providers. An example of what the config snippet looks like is shown below (you may need to change the assemblyname in the "type" attribute to match the name of your dll as well as the connection string):
<connectionStrings>
<add name="AccessFileName" connectionString="~/App_Data/ASPNetDB.mdb" providerName="System.Data.OleDb"/>
</connectionStrings>
<membership defaultProvider="AccessMembershipProvider">
<providers>
<clear/>
<add name="AccessMembershipProvider"
type="Samples.AccessProviders.AccessMembershipProvider, SampleAccessProviders"
connectionStringName="AccessFileName"
enablePasswordRetrieval="false"
enablePasswordReset="false"
requiresUniqueEmail="false"
requiresQuestionAndAnswer="false"
minRequiredPasswordLength="1"
minRequiredNonalphanumericCharacters="0"
applicationName="SampleSite"
hashAlgorithmType="SHA1"
passwordFormat="Hashed"/>
</providers>
</membership>
<roleManager enabled="true" defaultProvider="AccessRoleProvider" cacheRolesInCookie="true" cookieName=".ASPXROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All">
<providers>
<clear/>
<add name="AccessRoleProvider"
type="Samples.AccessProviders.AccessRoleProvider, SampleAccessProviders"
connectionStringName="AccessFileName"
applicationName="SampleSite"/>
</providers>
</roleManager>
<profile enabled="true" defaultProvider="AccessProfileProvider">
<providers>
<clear/>
<add name="AccessProfileProvider"
type="Samples.AccessProviders.AccessProfileProvider, SampleAccessProviders"
connectionStringName="AccessFileName"
applicationName="SampleSite"
description="Stores and retrieves profile data from an Access database."/>
</providers>
<properties>
<add name="FriendlyName" type="string" allowAnonymous="true" serializeAs="String"/>
</properties>
</profile>
<webParts>
<personalization defaultProvider="AccessPersonalizationProvider">
<providers>
<clear/>
<add name="AccessPersonalizationProvider"
type="Samples.AccessProviders.AccessPersonalizationProvider, SampleAccessProviders"
connectionStringName="AccessFileName"
applicationName="SampleSite"/>
</providers>
</personalization>
</webParts>
----------------------------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
andka771
Member
30 Points
6 Posts
Re: how to set roles and users using ms access instead of sqk server express?
Jan 28, 2006 10:27 PM|LINK
I am also trying this.
I have put a file called "OdbcMembershipProvider.cs" in the App_Code directory that is an exact copy from the "Sample Membership Provider Implementation" example in the documentation.
My web.config file looks like this:
<?
xml version="1.0"?><configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<
connectionStrings><add name="AccessFileName" connectionString="~/App_Data/ASPNetDB.mdb"
providerName="System.Data.OleDb"/>
</connectionStrings>
<
system.web><authorization>
<allow users="?" />
</authorization>
<
authentication mode="Forms"><forms name=".ASPXFORMSAUTH" loginUrl="HomePage/login.aspx"/>
</authentication>
<
membership defaultProvider="AccessMembershipProvider"><providers>
<clear/>
<add name="AccessMembershipProvider"
type="Samples.AccessProviders.AccessMembershipProvider, SampleAccessProviders"
connectionStringName="AccessFileName"
enablePasswordRetrieval="false"
enablePasswordReset="false"
requiresUniqueEmail="false"
requiresQuestionAndAnswer="false"
minRequiredPasswordLength="1"
minRequiredNonalphanumericCharacters="0"
applicationName="SampleSite"
hashAlgorithmType="SHA1"
passwordFormat="Hashed"/>
</providers>
</membership>
<compilation debug="true"/>
</system.web>
</configuration>
When I have entered UserId and Password in the Login-Control and pushes the Log In button I got the following message:
Server Error in '/Andreas' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.Parser Error Message: Could not load file or assembly 'SampleAccessProviders' or one of its dependencies. The system cannot find the file specified.
Source Error:
Source File: c:\inetpub\wwwroot\andreas\web.config Line: 30
Assembly Load Trace: The following information can be helpful to determine why the assembly 'SampleAccessProviders' could not be loaded.
I also tried to change Line 30 to:
type="Samples.AspNet.Membership.OdbcMembershipProvider, SampleAccessProviders"
because the first lines in the file OdbcMembershipProvider.cs looks like this:
namespace Samples.AspNet.Membership
{
public sealed class OdbcMembershipProvider : MembershipProvider
and got the same result.
How do I know what Line 30 should look like???
Best Regards,
Andreas
sschack
Contributor
3085 Points
617 Posts
Microsoft
Re: how to set roles and users using ms access instead of sqk server express?
Jan 30, 2006 05:22 PM|LINK
Since your provider is in App_Code, your type string only needs the namespace qualified type name:
type="Samples.AspNet.Membership.OdbcMembershipProvider"
----------------------------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
andka771
Member
30 Points
6 Posts
Re: how to set roles and users using ms access instead of sqk server express?
Jan 30, 2006 07:24 PM|LINK
I tried type="Samples.AspNet.Membership.OdbcMembershipProvider" and got the following error:
Server Error in '/Andreas' Application.
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
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.Data.Odbc.OdbcException: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Source Error:
Source File: c:\Inetpub\wwwroot\Andreas\App_Code\OdbcMembershipProvider.cs Line: 1285
Stack Trace:
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
sschack
Contributor
3085 Points
617 Posts
Microsoft
Re: how to set roles and users using ms access instead of sqk server express?
Jan 30, 2006 09:03 PM|LINK
That implies something wrong with the connection string. The connection string I showed earlier is for Access - and more specifically supports a special format that can be optionally used with the providers.
Since you are using ODBC, you need to use an ODBC connection string. There is a handy site out on the web that lists various connection string syntaxes - including ODBC:
http://www.connectionstrings.com/
Just browse the lefthand side of the page and select Access. You will then see an option for sample ODBC connection strings.
In your case for the "Dbq" attribute you would use the physical file path to the MDB. Something like "c:\inetpub\wwwroot\myapproot\App_Data\aspnet.mdb".
----------------------------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
andka771
Member
30 Points
6 Posts
Re: how to set roles and users using ms access instead of sqk server express?
Jan 31, 2006 07:50 PM|LINK
Hi
Changing the connectionstring to:
<connectionStrings>
<add name="OdbcServices"
connectionString="Driver={Microsoft Access Driver(*.mdb)}; Dbq=C:\inetpub\wwwroot\MyApp\App_Data\db1.mdb;Uid=Admin;Pwd=;"
providerName="System.Data.Odbc"/>
</connectionStrings>
did the trick.
Thanks a lot for your help Stefan !!!
Regards Andreas
Allen912
Member
15 Points
3 Posts
Re: how to set roles and users using ms access instead of sqk server express?
Feb 20, 2006 09:34 AM|LINK
I created the users, and roles on sql server 2005 express, but I was not able to set the authentification with it in local. As I will not be allowed to use SqlServer on the final webserver, I'd like to use the db access to store authenticate informations.
As I'm a real noob with MS Sql Server, can you tell me how to do the back up of the existing sql db and implement it in my access db ?
Thank you, and sorry for my english, I'm a Belgian french speaking.
Hope I'll receive help, it's not easy to find documentation to use MS Access and ASP.NET authentification...