in
Forums
Blogs
DevExpress.com
Client Center
Support Center
DevExpress Channel

Gary's Blog

Starring You #1 – XPO and Membership

In the first of our “Starring You” slots, Gary Cox shows us how to use the email address as the user name when using XPO. Don’t forget, if you have a great XPO or XAF tip that you think other users could benefit from and you’d like your name “up in lights”, then drop me an email at garysATdevexpressDOTcom with your idea.

Now, without further ado, I’ll let Gary tell us about membership and XPO.

Everyone wants to keep things simple, and when it comes to Membership following the standards will keep things simple. However, since we use XPO, the standards can still be followed but , at the same time, we can apply our own signature to our work. I use XPO and needed to handle Membership and Roles within my application. So to make a long story short I implemented this and wanted to share with you guys. In my case I needed to provide the ability to either use the User Name as the User Name or the Email Address field as the User Name. What this means is, if you use the standard .NET Membership controls and if useEmailAsUserName is true, then the code will expect an email address instead of the User Name. I made this a setting in the web.config.

Membership is configured like so:

<membership defaultProvider="PersistentMembership">
  <providers>
    <add name="PersistentMembership" 
         type="Persistent.Membership.PersistentMembershipProvider, Persistent.Membership" 
         useEmailAsUserName="false" />
  </providers>
</membership>

Role Manager is configured like so:

<roleManager defaultProvider="UserRolesProvider"
                 enabled="true"
                 cacheRolesInCookie="true"
                 cookieName=".ASPROLES"
                 cookiePath="/"
                 cookieTimeout="30"
                 cookieRequireSSL="false"
                 cookieSlidingExpiration="true"
                 cookieProtection="All"
                 >
  <providers>
    <clear />
    <add name="UserRolesProvider"
         type="Persistent.Membership.UserRolesProvider, Persistent.Membership"
         applicationName="PersistentRoles"
         writeExceptionsToEventLog="false" />
  </providers>
</roleManager>

I hope this helps at least one person and if you have any problems please let me know and I will assist you in correcting them. By the way, this was compiled with 8.2.3. You can download the code from here.

Digg This
Published Sep 09 2008, 12:13 PM by Gary Short (Developer Express)
Filed under:
Technorati tags: XPO

Comments

 

epiphany said:

Gary...

This has nothing to do with this post, but does devExpress have a CAPTCHA control?

September 9, 2008 4:23 PM
 

Gary's Blog said:

Hard on the heels of his first post , Gary Cox is back again, taking advantage of our “Starring You”

September 11, 2008 9:25 AM
 

Don Wibier said:

Hi Gary,

Great example, and just what I needed!

I was wondering if you also have a XPO ProfileProvider example available?

I have found an interesting article at:

searchwindevelopment.techtarget.com/.../0,289483,sid8_gci1270321,00.html

which has some optimized little thingies in the standard SqlProfileProfider so you can efficiently search members based on profile properties.

This example is still based on the default ms storedprocs and tables which we don't want to use in XPO projects.

The idea should be possible with XPO though.

Could you give me a start on it ?

November 24, 2008 4:13 AM

Leave a Comment

(required)  
(optional)
(required)  
Verification code: Required
   
Add
Copyright © 1998-2009 Developer Express Inc.
ALL RIGHTS RESERVED