Monday, April 10, 2006

I am probably late to this party, but somehow I recently discover this info so I thought I’d share it anyway. It is possible to use the ASP.NET providers in WinForms. Yes, you may need to read the previous statement again.. go ahead!

 

Ok, so what do you need to do to get the Membership, Roles, Profile, etc, providers to work? Well nothing really… ok just the same things that you would do in ASP.NET. Since the Winforms project templates do not automatically reference “System.Web”, then you will need to add that reference. This of course is achieved using the standard Add Reference window in Visual Studio.

 

 

 

Then, again just like you would in ASP.NET, add the required elements to the “app.Config”.

 

As a refresher this a boiler plate implementation of the standard configuration for memebership …

 

<system.web>

   <membership defaultProvider="SqlProvider"

      <providers>

         <clear />

         <add name="SqlProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="MySqlConnection"

            applicationName="MyApplication"

            enablePasswordRetrieval="false"

            enablePasswordReset="true"

            requiresQuestionAndAnswer="true"

            requiresUniqueEmail="true"

            passwordFormat="Hashed" />

      </providers>

   </membership>

</system.web>

 

Lastly, in you project you can use the object model just the same as you would in ASP.NET since the declarative model isn’t exactly available. Hope this was helpful for someone.

4/10/2006 9:57:59 AM (Eastern Standard Time, UTC-05:00)  #    Comments [6]  | 
6/5/2006 3:24:55 PM (Eastern Standard Time, UTC-05:00)
Hey - thanks a bunch! I just came across this post on a Google search trying to do the exact same thing!
12/14/2006 9:50:10 AM (Eastern Standard Time, UTC-05:00)
qwe
12/14/2006 9:50:38 AM (Eastern Standard Time, UTC-05:00)
hi
12/14/2006 9:51:00 AM (Eastern Standard Time, UTC-05:00)
hello
2/6/2007 4:06:19 PM (Eastern Standard Time, UTC-05:00)
Thanks, it was indeed helpful, exactly what I was looking for. :)
Lars Thomas
1/24/2008 1:23:31 PM (Eastern Standard Time, UTC-05:00)
Thanks a ton! Exactly what I needed.
Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):

Theme design by Jelle Druyts