Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Mere Mortals User Manger
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
00845087
Message ID:
00845196
Views:
10
>Thanks again for the quick response, Paul. You're quite a resource!
>
>I think I'm starting to understand your suggestion, but I'm still a little unclear. Could you clarify a couple of points?
>
>1. Wouldn't an instance of mmUserManager have to be created each time a page loads, so that it could set a reference to the Session object?
>
>2. Even if step 1 is correct, how would a business object be able to refer to that same instance of mmUserManager? The way the factory works now, it seems like when you request an instance of mmUserManager, you will get whichever one might currently be in memory, and that instance would be shared at the application level rather than the session level. So you woulnd't be guranteed to get your own individual instance, would you?
>
>If I've misunderstood anything about the MM framework, please correct me...

MM's creates a static reference to mmUserManager, so you'll always get the same instance of it. Yes, it's application-wide.

You're right in assuming that you can't depend on the rest of the information stored in the mmUserManager class to always be in sync with the current user - it's the nature of stateless applications.

I guess I assumed you already had code in your codebehind pages to call the user manager class to retrieve the user ID. The workaround I gave would always make sure that you'd get the correct user ID, w/o having to make changes to your existing code.

The way I probably would have handled this would be to validate the user via the mmUserManager class and then store the user ID in the Session object. If you need to pass the user ID to classes, retrieve it out of the session. Then I'd pass the user ID to any other classes that required this info, either via a field/property or as a parameter.

If your classes are assuming that they can retrieve the user ID directly from the mmUserManager class, shame on you <g>. That's one of those things that work OK in "normal" desktop applications, but fail in stateless (web) apps unless the class is smart enough to work in that environment. In that case, you'll probably need to add more code to the mmUserManager to reestablish the properties based on a user ID and make sure this gets called before you try to access any properties of it (eg. via the accessors, or just call the method to "refresh" from within the codebehind page).
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform