By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,853 Members | 1,052 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,853 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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...

--
Patrice

"daFou" <da***@discussions.microsoft.com> a écrit dans le message de
news:DC**********************************@microsof t.com...
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

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.