If we declare a static
variable in Global.asax
then how to access it inside an ASP.NET
page ?
<script runat=server">
public static object myObject = new MyClass();
// Application_Start() and other stuff goes here.
</script>
And, is this a good idea for storing a global object (same instance for all requests) ?
myObject should be available to all the methods in global.asax and inside your ASP.NET pages using
Global.myObject
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With