Hello,
I would like to use my custom membership provider (which is working in my asp.net application) in my windows forms application.
I thought this would be relatively straight forward, and followed these steps:
1. Copied MembershipProvider class into my application.
2. Add reference to System.Web
3. Create app.config with membership settings i.e:
I have some code where I need to validate the user against the database:Code:<configuration> <configSections> </configSections> <system.web> <authentication mode="Forms"> <forms name=".ASPXFORMSAUTH" /> </authentication> <machineKey validationKey="*****" /> <!-- Removed for example --> <membership defaultProvider="CurveMembershipProvider"> <providers> <clear /> <add name="CiseroMembershipProvider" type="CiseroMembershipProvider" applicationName="CurveWin" connectionStringName="CurveWin" passwordFormat="Hashed"/> </providers> </membership> </system.web>
Membership.ValidateUser is a member of system.web.security. My class method for ValidateUser should be called here, but I get the following message:Code:Public Function RenewLicense(ByVal username As String, _ ByVal password As String) As Boolean ' TODO: validate user, get license key and expiry date If Membership.ValidateUser(username, password) Then Dim User As CiseroMembershipUser = System.Web.Security.Membership.GetUser License = New License
Could not load type 'CiseroMembershipProvider' from assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
This also happened at one time in my asp.net application, but was easily solved by moving the class to the app_code folder.
I have tried changing the type setting of the membership provider to MyApp.CiseroMembershipProvider, but I still get the error.
I also noticed that the class initialize method was not being called, so I added the following:
The same error occurs.Code:System.Web.Security.Membership.Provider.Initialize("CiseroMembershipProvider", ConfigurationManager.AppSettings)
Does anyone know a solution?
Thanks for reading





Reply With Quote