First of all, forget ASP.NET. The scope of the question is .NET or CLR, nothing else. It's good to know what it is:
http://en.wikipedia.org/wiki/Common_Language_Runtime[
^],
http://en.wikipedia.org/wiki/.NET_framework[
^]. :-)
Now, both things you mentioned do not exist in .NET, and this is very good. All variable are only stack objects (local variables). Do you know how stack works? If not, you need to learn it, it's a separate topic. They are not allowed to be static.
There are only static members of the types. Some are always static (such as enumeration members), but usually they are either static or non-static (instance members). When you defined a structure or a class, you can create instances of them (objects), unless these types are non-static themselves. And you can define static or non-static members like fields, properties and even instances. Each instance (non-static) member is different and independent for each instance, and can be accessed only by an instance, using some instance members. As to the static member, it exist only one per whole class. In this sense, they are functionally nearly equivalent to "custom" global variables. But they are not global variables: they are safer and easier to use.
Now, there are also static methods and static types. Static types are simple: they just have only static members and come with the
static
keyword used to prevent creating an instance. And static methods are those which have no access to the instance (which is passes as a hidden "this" parameter). Further consideration of static vs instance method is beyond out topic, but I only want to say that static methods are often very needed.
But static fields, properties and event instances should be avoided in most cases. Usually, it's possible to avoid them at all; and such programs are the best. In rare cases, they can be used, but
with care.
And it's better not to use them freely, but to use them via the
singleton pattern,
which itself should be used with care. Please see:
http://en.wikipedia.org/wiki/Singleton_pattern[
^],
http://csharpindepth.com/Articles/General/Singleton.aspx[
^].
I saw many very bad implementation of singleton, but the one referenced above is good. Read to understand why.
—SA