Sample Access Providers Starter Kit problem

Discussion in 'ASP.NET 2.0' started by beaufred, Jan 7, 2006.

  1. Hi,

    I just purchase a hosting with DASP but I am having problem running it. I don't have the SQL addon and I want to use the Profile feature of ASP.NET 2, so I download the "Sample Access Providers Starter Kit" from Microsoft to use on an Access DB.

    It work well on my computer, but I got the following error on my DASP site:
    ************************************************************
    Server Error in '/' 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 type 'System.Configuration.Provider.ProviderBase' from assembly 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

    Source Error:






    Code:
    Line 60: 			<providers>
    Line 61: 				<add name="AccessRoleProvider" 
    Line 62: 					type="Samples.AccessProviders.AccessRoleProvider, SampleAccessProviders" 
    Line 63: 					connectionStringName="AccessFileName" 
    Line 64: 					applicationName="SampleSite"/>
    Source File: E:\web\qcwebtechco\htdocs\web.config Line: 62
    ************************************************************

    I download the code from this link and compile it (because my code is in VB and this code is in C#).
    http://go.microsoft.com/fwlink/?linkid=49646&amp;clcid=0x409

    It seems like it can't find the DLL, or the DLL is not register. Could it be a security issue on the folder because I accidently delete the "bin" folder, so I recreate it but maybe it's missing security??

    Any idea?
    Thanks!
     
  2. I found the solution.
    The error was because I compiled with the BETA 2 version of VS. So I uninstall it and install the Express version 2.0 final. Then I recompile and it work.
     
  3. It's a lot trickier to use Access DB conns in your web.config than it is to make connections to SQL Server.
    The conn string has to point to the physical Access DB.

    Like this:
    <add name="AccessFileName" connectionString="Data Source=C:\inetpub\wwwroot\App_Data\ASPNetDB.mdb" providerName="Microsoft.Jet.OLEDB.4.0" />
     
  4. I tried the physical connection string too and I still get the same error.
    ex: <add name="AccessFileName" connectionString="E:\web\xxx\htdocs\App_Data\ASPNetDB.mdb" providerName="System.Data.OleDb"/>
     
  5. Several of us have seen odd things happen with the protection ASP.NET includes for the App_Data folder.
    Try moving that Access DB to another folder on the site and run some tests with the new folder.
    DASP provides a protected _database folder with each site you could use for those.
    I've even seen Access DB's fail locally in the App_Data folder.
     
  6. I moved the database to the _database folder and I got the same error. I'm using a different access database to serve the content of this site and I don't get a problem. If I use a seperate login page that does not use the AccessProviders, it works fine. I wanted to use the access providers to be able to use the Login Controls in Visual Studio so that I can save time in writing lost password and other functions that the login controls seem to provide. Now I've spent 3 days on this problem.It would be faster to just drop using the login controls and write all of the code myself, butthis is bugging me so muchthat Iwant to get this figured out.

    Post Edited (hiwater) : 11/12/2007 6:26:43 PM GMT
     
  7. I can see that it is frustrating.
    Still willing to help you with this but rather hard offering more help on this end.

    Have you considered moving the Access DB connections out of the web.config and using them in the pages?
    Thing is, while Access DBs still work very well in ASP.NET they're not typically used for login controls or anything secure.
    They work pretty well for things you want disconnected from your SQL Server DB, i.e. pages subject to hacking or spam.
    Salute,
    Mark
     
  8. I found this note on another blog. I think the DASP servers are windows 2003 servers. My development environment is Vista Ultimate on a 32 bit machine. Note:

    "The issue exists when moving from 32-bit to 64-bit OS, with the state that there are no x64 assemblies available for AccessProviders.


    If so, you may try to change the IIS on the x64 bit machine to run 32 bit mode like this articleand see if it works.


    http://support.microsoft.com/default.aspx?scid=kb;en-us;895976"</BLOCKQUOTE>
     
  9. Wow, thanks for posting that. [​IMG]
     
  10. I'm getting the exact same problem as you had. It runs fine on my desktop, but it gets the same error pointing to the providers type line in my web.config when I deploy the app to my DicountASP.net hosting account. I'm using VS2005, and not the beta.
    I added the providers classes to my App_Code folder and modified the web.config by getting rid of the second Type= parameter sinse I'm not loading an outside assembly. Again it worked fine running on IIS on my Vista machine, but I got the same error when deployed to DASP hosting account.

    Does anyone have any sugestions as to what the problem could be? Below is my web config file. It works fine if I comment out the Access DB Providers info and deploy the web.config, but my login pages don't work.




    <configuration>
    <appSettings>
    <add key="SMTPServer" value="localhost"/>
    <add key="BuildVersion" value="2.0"/>
    </appSettings>
    <connectionStrings>
    <add name="AccessFileName" connectionString="~/App_Data/ASPNetDB.mdb" providerName="System.Data.OleDb"/>
    <!--<add name="AccessFileName" connectionString="~/App_Data/ASPNetDB.mdb" providerName="System.Data.OleDb"/>-->
    </connectionStrings>
    <system.web>
    <pages>
    <controls>
    <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    </controls>
    <namespaces>
    <clear />
    <add namespace="System" />
    <add namespace="System.Collections" />
    <add namespace="System.Collections.Specialized" />
    <add namespace="System.Configuration" />
    <add namespace="System.Text" />
    <add namespace="System.Text.RegularExpressions" />
    <add namespace="System.Web" />
    <add namespace="System.Web.Caching" />
    <add namespace="System.Web.SessionState" />
    <add namespace="System.Web.Security" />
    <add namespace="System.Web.Profile" />
    <add namespace="System.Web.UI" />
    <add namespace="System.Web.UI.WebControls" />
    <add namespace="System.Web.UI.WebControls.WebParts" />
    <add namespace="System.Web.UI.HtmlControls" />
    </namespaces>
    </pages>
    <compilation debug="true">
    <assemblies>
    <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    <add assembly="System.Runtime.Serialization.Formatters.Soap, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="System.ServiceProcess, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies>
    </compilation>
    <!-- CUSTOM ERROR MESSAGES
    Set customErrors mode="On" or "RemoteOnly" to enable custom error messages, "Off" to disable.
    Add <error> tags for each of the errors you want to handle.


    "On" Always display custom (friendly) messages.
    "Off" Always display detailed ASP.NET error information.
    "RemoteOnly" Display custom (friendly) messages only to users not running
    on the local Web server. This setting is recommended for security purposes, so
    that you do not display application detail information to remote clients.
    -->
    <customErrors mode="Off" defaultRedirect="Error.aspx"/>
    <!-- AUTHENTICATION
    This section sets the authentication policies of the application. Possible modes are "Windows",
    "Forms", "Passport" and "None"


    "None" No authentication is performed.
    "Windows" IIS performs authentication (Basic, Digest, or Integrated Windows) according to
    its settings for the application. Anonymous access must be disabled in IIS.
    "Forms" You provide a custom form (Web page) for users to enter their credentials, and then
    you authenticate them in your application. A user credential token is stored in a cookie.
    "Passport" Authentication is performed via a centralized authentication service provided
    by Microsoft that offers a single logon and core profile services for member sites.

    -->
    <authentication mode="Forms">
    <forms name="Form1" loginUrl="~/secure/Login.aspx" timeout="120"/>
    </authentication>
    <membership defaultProvider="AccessMembershipProvider">
    <providers>
    <clear/>
    <add name="AccessMembershipProvider" type="AccessProviders.AccessMembershipProvider" connectionStringName="AccessFileName"
    enablePasswordRetrieval="true"
    enablePasswordReset="true"
    requiresUniqueEmail="false"
    requiresQuestionAndAnswer="true"
    maxInvalidPasswordAttempts="3"
    minRequiredPasswordLength="6"
    minRequiredNonalphanumericCharacters="1"
    applicationName="ArtsYouniversity"
    hashAlgorithmType="None"
    passwordFormat="Clear"/>
    </providers>
    </membership>
    <roleManager enabled="true" defaultProvider="AccessRoleProvider" cacheRolesInCookie="true" cookieName=".ASPXROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All">
    <providers>
    <add name="AccessRoleProvider"
    type="AccessProviders.AccessRoleProvider"
    connectionStringName="AccessFileName"
    applicationName="ArtsYouniversity"/>
    </providers>
    </roleManager>
    <profile enabled="true" defaultProvider="AccessProfileProvider">
    <providers>
    <add name="AccessProfileProvider"
    type="AccessProviders.AccessProfileProvider"
    connectionStringName="AccessFileName"
    applicationName="ArtsYouniversity"
    description="Stores and retrieves profile data from an MS Access database."/>
    </providers>
    <properties>
    <add name="FriendlyName" type="string" allowAnonymous="true" serializeAs="String"/>
    <add name="Height" type="int" allowAnonymous="true" serializeAs="String"/>
    <add name="Weight" type="int" allowAnonymous="true" serializeAs="Xml"/>
    </properties>
    </profile>
    <anonymousIdentification enabled="true" cookieName=".ASPXANONYMOUS" cookieTimeout="100000" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="None" domain=""/>
    <webParts>
    <personalization defaultProvider="AccessPersonalizationProvider">
    <providers>
    <add name="AccessPersonalizationProvider" type="AccessProviders.AccessPersonalizationProvider" connectionStringName="AccessFileName" applicationName="ArtsYouniversity"/>
    </providers>
    </personalization>
    </webParts>
    <!--
    <trust level="Medium"/>
    -->
    <!-- AUTHORIZATION
    This section sets the authorization policies of the application. You can allow or deny access
    to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous
    (unauthenticated) users. </forms>
    </authentication>
    -->
    <authorization>
    <allow users="*"/>
    </authorization>
    </system.web>
    <location path="secure">
    <system.web>
    <authorization>
    <deny users="?"/>
    </authorization>
    </system.web>
    </location>
    </configuration>
     
  11. Bruce

    Bruce DiscountASP.NET Staff

    we are not running 64 bit OS. I don't think this is the problem.


    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     

Share This Page