how to set a 'global' variable in global.asax

  • Thread starter Thread starter Jason Shohet
  • Start date Start date
J

Jason Shohet

Lets say i have a numeric value drom a dropdown that is set on 1 page, but
that the rest of my application needs afterwards.
I'm trying to think of other ways besides a session / application variable,
to accomplish this. So I don't have to bother with the overhead, session
management etc. Its basically a 'global' variable. Is there a way using
structs and / or global.asax to do this.

TY
Jason Shohet
 
Hi,

There are only two options depending of the scope of it

1- Session scope:
The only way you can go is using Session variable, I do not think that
you will get any overhead with this, the only different been the way to get
to its value and the need to cast(unbox) it.

2- Application:
You can use an application variable with the same notes that above, OR you
can use a static public member of a class, with this you don;t have to cast
it back but you have to be careful with concurrency.

Cheers,
 
I once read something about public structs + the global.asax....
Have any idea what the story is with this tactic, or how its supposed to
work & for what usage?
TY
 

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

Back
Top