How to access shared members in an ASP.NET 2.0 global.asax

G

Guest

Please help me how to access shared members in my global.asax in ASP.NET 2.0
This is what i do.

First I create a new website using VS.NET 2005. I select a location where
the website should be created.
Now VS.NET creates a default.aspx for me and a web.config.

I create a global.asax page and change it to look like this:
<%@ Application Language="VB" %>
<script runat="server">
Public Shared appArrList As ArrayList
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
appArrList = New ArrayList
End Sub
</script>


Now how do i access appArrList from my default.aspx.vb?
I am unable to do it.
And also my default.aspx.vb does not reside in a namespace.
It simply looks like this:
Public Class _default
Inherits System.Web.UI.Page
End Class
Not sure if this is important or not

please anyone help me out here coz ASP.NET 2.0 is making my life so much
harder then ASP.NET 1.0
 
P

Patrice

You could output the full name of the class in one of the event so that you
see the fully qualified name (or try to build all once and see if the object
brower helps).

My personal architectural preference would be to put those shared members in
my own class as it doesn't really belong to the "technical" application
object provided by ASP.NET but rather to my own "Application specific
context" class...

Also note that shared members are shared by all users...
 

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,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top