Sunday, June 24, 2012

Asp.net Authentication and Authorization in Winodws Applications

i was developping  a web application with asp.net authentication model for a client.
every thing went well but certainly client asked for a desktop version with of course authroization and authentication. both applications were hitting to same database so same authentication model was required for desktop application was required
so by just adding the following configurations in app.config of my desktop application it was possible to use Membership of asp.net authentications in windows appliation
<membership>
    
      <providers>
       
        <remove name="AspNetSqlMembershipProvider"/>
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web,
           Version=2.0.0.0, Culture=neutral,
           PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="MedBillUtility.Properties.Settings.AFileStorageDBConnectionString" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="3" minRequiredPasswordLength="4" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
      </providers>
     
    </membership>
but then i realized thought authentication is done but i m still unable to authorization because role manger is not available so to enable role manger so i had to add following section in my app.config as well under System.web
   <roleManager enabled="true">
      <providers>
        <remove name="AspNetSqlRoleProvider"/>
        <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web,
           Version=2.0.0.0, Culture=neutral,
           PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="MedBillUtility.Properties.Settings.AFileStorageDBConnectionString" applicationName="/"/>
      </providers>
    </roleManager>
and all worked .

Microsoft.Jet.OLEDB.4.0 provider is not registered on the local machine.

I was having this issue on my client machine , with windows server 2008 os application wa working fine on my machine , but when deployed it was producing the issue that provider is not registered .
I tried to chage the provider to 'Microsoft.ACE.OLEDB.12.0'  but the issue remained unresolved.
i then downloaded the 64 bit egine for Access from microsoft and it worked for me
Access database engine can be found here
http://www.microsoft.com/en-us/download/details.aspx?id=13255