Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Membership Provider session vs cache

Posted on 2010-11-20
4
Medium Priority
?
867 Views
Last Modified: 2012-08-14
Hello.

I've created a custom membership and role provider for our site. Essentially it loads a dataset of commonly used user data into that user's session after authentication. This way we limit some of the DB calls throughout the site. All updates work OK since I first update the session dataset then then database when updates occur.

One issue I've now run into is that the user's can change their names through an admin page that is queued up. The admins then accept/deny the change. If they accept the change, the user info is updated in the database... but not the user's session object (obviously). This creates a problem with the user data not being updated when they are logged in.

Anyone have any good ideas on how to handle the admin update so as not to compromise the data integrity when the user is logged on?

Is there any reason I can't hold the user's session dataset in the applications cache instead? That way the admins and the users are updating the same dataset when the user is logged in.
0
Comment
Question by:dacIT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 17

Expert Comment

by:Jesse Houwing
ID: 34182778
Place the details in the Application object, that is kind of the Session object, but then for the whole application. You will need to implement a readerwriterlock on the variable, otherwise different threads can override each others changes.

Here is a (rather old) article on how to use the Application scope.
http://www.eggheadcafe.com/articles/20030211.asp

One issue with this setup is that the Application scope is linked to the AppPool the site runs under, so if you have multiple hosts in your setup, each will have its own instance of the data. You should consider using AppFabric Caching as an alternative if this scenario applies to you.
0
 
LVL 7

Author Comment

by:dacIT
ID: 34245614
Wow thanks. Hadn't even heard of the application variable.

It still seems to me that the global cache might be better in that I can purge that on a time schedule pretty easily after so many minutes of disuse.

Is the HttpRuntime.Cache object the same across server farms?
0
 
LVL 17

Accepted Solution

by:
Jesse Houwing earned 2000 total points
ID: 34246179
Not, the cache is not synced across farms, neither is the application variable.

If you use AppFabric Caching, you can have a centralized cache cluster.
0
 
LVL 7

Author Closing Comment

by:dacIT
ID: 34249875
Thanks for your help!
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question