473,952 Members | 10,461 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_Sta rt(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.P age
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 1444
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 "Applicatio n specific
context" class...

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

--
Patrice

"daFou" <da***@discussi ons.microsoft.c om> a écrit dans le message de
news:DC******** *************** ***********@mic rosoft.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_Sta rt(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.P age
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
1629
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? The value that I need global to the entire project is the oleDB connection string ("Provider=.... Data Source=C:\..."). What I've done in the meanwhile is declare a shared property in each of the classes to hold this value. When the...
2
1699
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 shared function tom() as string tom = "This is the shared sub"
10
3050
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() { throw new Exception("Foobar"); }
15
4967
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 String ' this is ineffect a global application object End Module
2
2385
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 variable is goTest, I thought I can reference it as Global.goTest but I see that I cannot. Thanks.
27
2579
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: Mensaje de error del analizador: We can't load the type 'JULIAN.Global'.
1
1414
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 from data that don't change very often.....but it could change. So I have my method in Global.asax (it can't be Shared because it would lost Application object scope), and I would like to call it manually to
5
2703
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 that's come before. To take an extreme example, suppose you have been writing Visual Basic applications for years now. If you're like many developers, you will have built up a substantial inventory of code in that time. And if you've been following...
11
8397
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 generated code on a W2K3 server the application_start and any other event on the global.asax file won't fire. I added tracing and logging to make sure and I can see the code is just not execution. When running the same exact (deployed etc.) code on...
0
9999
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11209
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11381
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9917
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8283
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7451
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6239
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4562
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3567
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.