Re: Static Class Factory - Alice is seeing Bob's data



Thanks for the replys - I've read the article Patrice recommended.

I understand that using static objects can have issues with shared values e.g.

static class TempStore
{

int myValue;

static TempStore()
{}

static Int GetValue()
{
return myValue;
}

static SetValue(int inpVal)
{
myValue = inpVal;
}
}
}

I can see that this would be bad as users will continuously be overwriting
each others values, but I don't see why this would be for a static class
factory

static class ClassFactory
{
static ClassFactory()
{}

static ProfileData GetProfile(Guid userID)
{
....Load DAL
....Get data
....Return data
}
}


Why would the GetProfile method above return the wrong data to the user?

Thanks
"Mark Rae [MVP]" wrote:

"rival@xxxxxxxxxxxxxxxxx" <rivalnewsgroupsnospam@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote in message news:2CE233A8-8B05-4688-8A80-C251D505B528@xxxxxxxxxxxxxxxx

Have I royally messed up my architecture here?

Static variables in ASP.NET need *extremely* careful management because they
persist across all Sessions. That's almost certainly what you're seeing
here...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net


.