473,513 Members | 2,561 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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
1 1427
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1613
by: trebor | last post by:
I added a couple of class files to a VS web project, and I can't access the application object from inside them. The system treats them like undeclared variables. Is there an Imports I have to use?...
2
1680
by: tshad | last post by:
I am trying to set up some shared functions in my Global.asax file and can't seem to get it to work. In my Global.asax: Public Class myUtils inherits System.Web.HttpApplication public...
10
3010
by: Ronnie | last post by:
I've created a simple web application using VS2005 Beta 2. Basically, I've added a Web Form and a Global.asax file. In my Global.asax, I create a method like: public static void TestGlobal()...
15
4898
by: Rob Nicholson | last post by:
A consequence of the ASP.NET architecture on IIS has just hit home with a big thud. It's to do with shared variables. Consider a module like this: Public Module Functions Public GlobalName As...
2
2352
by: vvenk | last post by:
Hello: I have defined public variables in Global.asax.vb that are initialized in the application_start event. How do I reference these variables in other ASP forms? For example, if my...
27
2526
by: Javier Martinez | last post by:
Hi I have asp application in a machine with a virtual directory referring a shared directory in another machine When I try to load any aspx page of my portal I get the following error: ...
1
1392
by: Fabio Cavassini | last post by:
Hi, I have made a method in Global.asax called from Application_Start event that loads some cache data from database to Application scope objets. This is necessary because this is some data...
5
2661
by: Lyle Fairfield | last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/callnetfrcom.asp The Joy of Interoperability Sometimes a revolution in programming forces you to abandon all...
11
8321
by: Ron | last post by:
I have a web project compiled with the new "Web Deployment Projects" plugin for VS2005. I'm deploying the web project to one assembly and with updateable option set to ON. When I'm running the...
0
7259
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7380
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7535
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7098
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7523
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
455
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.