Variables C#

  • Thread starter Thread starter Franck
  • Start date Start date
F

Franck

I have an application that i just found a big problem. i used Static
variable thinking all instance of my application would have his own
variable. I doesn't seems to. I thought it would have been like
multiple instance of C# app under windows application but doesn't
seems so,

So my question is. What is the equivalent of static variable in
Asp.net. i know there is session variables but my logic is already
implemented based as static is global to my whole application. so if
it's just a matter to change the static word to something else it
would be the best

thank you.
 
I forgot to said that i had found Session[""] variables but they are
instantiate at the begining. i wonder how can i declare them as type
(string,bool,int32)
 
make a static class:

public class MySession
{
public string Var1
{
get { return (string) HttpContext.Current.Session["Var1"]; }
set { HttpContext.Current.Session["Var1"] = value; }
}
}

you really should add code to handle lost session, or a read before a set.


-- bruce (sqlwork.com)
 
Back
Top