asp.net + static/shared classes

J

jg

Im experience some problems with static/shared classes in asp.net, Im saving
some object as static so that they are allways available but the code in the
static/shared constructors doesnt seem to execute??
 
A

Anon-E-Moose

Im experience some problems with static/shared classes in asp.net, Im
saving some object as static so that they are allways available but
the code in the static/shared constructors doesnt seem to execute??


Are just calling the functions directly... i.e: SharedClass.SharedFunction?

If this is the case, the constructor won't be executed since the object is
not really created. If you wish to execute the constructor, you'll need to
explicitly create the object (i.e. dim object = new object()).
 
M

Marina

You should show some code that you think is not executing, and give us the
minimum relevant code to look at.

Also, try setting a breakpoint in the static constructor before the first
reference to a static object is made in your app (so do this right after
asp.net restarts, but before the first call to your object happens).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top