Loading/Caching Objects Prior to Authentication

Loading/Caching Objects Prior to Authentication

Old forum URL: forums.lhotka.net/forums/t/4008.aspx


Mike.Smith posted on Saturday, December 08, 2007

I am using CSLA in a Win Forms app with CSLA authentication. In order to speed the perceived load time, I wanted to cache some of my picklists (that are used by every user) behind the login form. So basically, this would be happening on a different thread at the same time the user is typing in their credentials. The only problem with this is that there is no authenticated user at the time that I need to load these objects.

Is what I am trying to do a bad idea? Should I just wait until I have an authenticated user or is there a way to skirt the authentication for a couple of generally used objects so I can get them cached before the user actually logs in and needs them?

Mike

RockfordLhotka replied on Saturday, December 08, 2007

Assuming anyone can get those objects, then you could do what I do in PTWin and have the application "logout" as its first step. That establishes a valid, but unauthenticated, principal for the UI thread.

Of course if you are using a different thread anyway, then that thread wouldn't have the normal principal anyway. So when you spin up that thread you can establish a valid, unauthenticated principal on that thread before loading the objects.

Copyright (c) Marimer LLC