473,378 Members | 1,444 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

ASP.NET 2.0 - Application level Collection - HELP !

Hello!

I have (hopefully) a very simple question. I need to define an application
level collection variable for an ASP.NET 2.0 web application, and fill it
with data when the application starts.

The collection needs to be defined and filled with data on the
"Application_Start()" event, which is in the Global.asax file, however, I'm
having trouble deciding where the collection needs to be declared in order
for it to be accessed globally across all pages.

In case it's of any use, the collection is going to hold all the dialogue
for a website.

--
welcome to the mooon !
Mar 14 '06 #1
1 832
Ok, I think I may have found a solution:

In the Application_Start section of the global.asax, I create a collection
called colDialog, fill it with data, and then add it into the application
object by using this syntax:

Application.Add("DIALOG", colDialog)

Then, if I want to reference this collection within an aspx.vb file, I use
this syntax:

Dim colDialog As Collection = Application("DIALOG")
Is this a good way of acheiving what i'm trying to achieve? One annoying
factor in doing this seems to be that I can't write one global function to
retrieve this data whenever I want to, I'll need to write a function to
retrieve the dialogue inside every aspx.vb page, because i can't seem to be
able to create a global function from within a .VB file held in VB2005's new
"app_code" folder.

Plus also, I don't think that files in the "app_code" folder can access the
application object. I've played around with importing different web
references but that didn't help.
--
welcome to the mooon !
"m00nm0nkey" wrote:
Hello!

I have (hopefully) a very simple question. I need to define an application
level collection variable for an ASP.NET 2.0 web application, and fill it
with data when the application starts.

The collection needs to be defined and filled with data on the
"Application_Start()" event, which is in the Global.asax file, however, I'm
having trouble deciding where the collection needs to be declared in order
for it to be accessed globally across all pages.

In case it's of any use, the collection is going to hold all the dialogue
for a website.

--
welcome to the mooon !

Mar 14 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: hplloyd | last post by:
I am fairly new to VB.NET programming but have built many database applications in Access SQL Server etc. I need to find a good book or other reference material that will help me take my OO...
1
by: Brian Orrell | last post by:
I know how to deserialize a collection class that is referenced in a container class as a variable or property using the XmlArray and XmlArrayItem attributes. What I can't for the life of me...
5
by: RP | last post by:
Hi all, I wanted to know if there are any limitations to storing some custom objects I have written at application level to avoid having to create/destroy with every request. These are not ado...
4
by: Keith Chadwick | last post by:
I am having some trouble referencing an Application("myVar") variable from within a module.vb file on my ASP.NET site. According to the documentation I should be able to reference...
5
by: TomislaW | last post by:
What is asp.net equivalent for Application("Root") in asp?
2
by: Mel | last post by:
This may be a stupid question, but here goes... I have created a NameValueCollection in my website's application state. If, during a page request, I add a string key and string value to the...
7
by: Greg Collins [MVP] | last post by:
Hi, I couldn't find what I was looking for by searching the newsgroup, but perhaps these have already been discussed somewhere. This is a bit long with a lot of interrelated questions. What I've...
3
by: Jerry Spence1 | last post by:
How can I gain access to all the threads running in my application? I'm looking for something like: Application.Threads.count Application.threads(item).IsAlive Application.threads(item).Name ...
4
by: divy24 | last post by:
Hi , Is it possible to get Forms Collection of the Projects in an Application at a common place in the application?.My requirement is to get Form Names in the application and do some processing on...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.