Static members are also not thread-safe..which is dangerous in ASP.Net.
What I've seen most people do is use a smart provider.
public interface IStateInformation
void Add(object key, object value);
void Remove(object key);
...
end interface
interneal class WebState : IStateInformation
public void Add(object key, object value){
HttpContext.Current.Session.Add(key, value);
}
public void Remove(object key){
HttpContext.Current.Session.Remove(key);
}
}
internal class WindowsState : IStateInformation
private static Hashtable _state = new Hashtable;
public void Add(object key, object value){
WindowsState._state.Add(key, value);
}
public void Remove(object key){
WindowsState._state.Remove(key);
}
}
public class StateProvider{
public statc IStateInformation GetProvider{
get {
return (HttpContext.Current != null) ? new WebState() : new
WindowsState();
}
}
}
Anyways, I have no doubt my implementation is bogus..but hopefully it gets
you off in the right direction....I think my WindowState is really
screwed...I'm stuffy..can't tthink...
karl
--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Mantorok" <none@tiscali.co.uk> wrote in message
news:d1unk9$f97$1@newsfeed.th.ifl.net...[color=blue]
>
> "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
> wrote in message news:OrxF6hIMFHA.3336@TK2MSFTNGP09.phx.gbl...[color=green]
> > No. You could use instance properties instead, but then you'd have to
> > carry
> > around the instance in the session for it to persist from request to
> > request. You'll likely need to explain your needs in more detail in[/color][/color]
order[color=blue][color=green]
> > to get any useful help..specifically with respect to why you can't use
> > sessions and what you are trying to do..[/color]
>
> No is all I needed to know, the reason I asked is because the ASP.Net is
> using a framework we developed for use on a windows forms client,[/color]
obviously[color=blue]
> if you fire up the app more than once you get a clean slate, but with
> ASP.Net it is session-based.
>
> So rather than relying on the static member used by the framework, I'll[/color]
need[color=blue]
> to adjust to Session variables.
>
> Thanks
> Kev
>[color=green]
> >
> > --
> > MY ASP.Net tutorials
> >
http://www.openmymind.net/ - New and Improved (yes, the popup is
> > annoying)
> >
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
> > come!)
> > "Mantorok" <none@tiscali.co.uk> wrote in message
> > news:d1umqh$epr$1@newsfeed.th.ifl.net...[color=darkred]
> >> Hi
> >>
> >> I have an ASP app which references a few static properties in some of[/color][/color][/color]
the[color=blue][color=green][color=darkred]
> >> classes. I understand that you should use Session variables, but is it
> >> "possible" to have each session "not" reference the same static[/color][/color][/color]
members.[color=blue][color=green][color=darkred]
> >>
> >> For example if I update the static member on one session this change[/color][/color][/color]
will[color=blue][color=green]
> > be[color=darkred]
> >> reflected on somebody elses session, which I don't want.
> >>
> >> I hope there's an easy solution for this as changing to session[/color][/color][/color]
variables[color=blue][color=green][color=darkred]
> >> may prove to be a pain.
> >>
> >> Thanks
> >> Kev
> >>
> >>[/color]
> >
> >[/color]
>
>[/color]