473,407 Members | 2,306 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,407 software developers and data experts.

Creating & accessing an application wide array.

I am developing a web solution.

I would like to create a dynamically sized array of strings at application
start (presumably in the "Application_Start" event), which can then be
referenced through subsequent "page level" objects.

I only want to dynamically create the array once, so it seems that it cannot
be defined in either the "Global.asax" module or the "HttpSessionState"
object.

So, can this be achieved? If so how / where do I created the array?

Thanks, Steve
Nov 21 '05 #1
2 1064
OK, so after a little research, I have found the "Application" object. In my "Application_Start" event I now have;

Dim strMyVal As String = "test-string"
Application.Add("testvar", strMyVal)

Which seems to work (well at least doesn't give me an exception). I am now trying to retrieve the variable with;

Return Application.Item("testval")

Which gives me; "Object reference not set to an instance of an object."

Any ideas? Thanks, Steve

"Steve" <sj****@hotmail.com> wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl...
I am developing a web solution.

I would like to create a dynamically sized array of strings at application
start (presumably in the "Application_Start" event), which can then be
referenced through subsequent "page level" objects.

I only want to dynamically create the array once, so it seems that it cannot
be defined in either the "Global.asax" module or the "HttpSessionState"
object.

So, can this be achieved? If so how / where do I created the array?

Thanks, Steve

Nov 21 '05 #2
OK, so after a little more trial and error, it looks as though you have to reference the application object through the a page object. In a nutshell, problem solved! Sorry to have wasted time for those who have read & actually thought about this on my behalf!

Steve

"Steve" <sj****@hotmail.com> wrote in message news:uU**************@TK2MSFTNGP09.phx.gbl...
OK, so after a little research, I have found the "Application" object. In my "Application_Start" event I now have;

Dim strMyVal As String = "test-string"
Application.Add("testvar", strMyVal)

Which seems to work (well at least doesn't give me an exception). I am now trying to retrieve the variable with;

Return Application.Item("testval")

Which gives me; "Object reference not set to an instance of an object."

Any ideas? Thanks, Steve

"Steve" <sj****@hotmail.com> wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl...
I am developing a web solution.

I would like to create a dynamically sized array of strings at application
start (presumably in the "Application_Start" event), which can then be
referenced through subsequent "page level" objects.

I only want to dynamically create the array once, so it seems that it cannot
be defined in either the "Global.asax" module or the "HttpSessionState"
object.

So, can this be achieved? If so how / where do I created the array?

Thanks, Steve

Nov 21 '05 #3

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

Similar topics

5
by: K | last post by:
I have found a script online that I want to use (I am new to PHP). It creates dynamic images based on the text that you pass it. However, no matter how I try, I can't get anything other than a...
14
by: billy.becker | last post by:
I need to save a wav file that is HTTP POSTed to a php page. What does PHP5 do automatically to a POSTed variable when it puts it in the $_POST superglobal array? I haven't been able to find any...
4
by: MLH | last post by:
A programmer developed an AMP (Apache/MySQL/PHP) application for me. When he was done, he sent me the PHP files and the MySQL dump file. Now, when I connect to the application on my LAN using...
4
by: johkar | last post by:
When the output method is set to xml, even though I have CDATA around my JavaScript, the operaters of && and < are converted to XML character entities which causes errors in my JavaScript. I know...
22
by: roadrunner | last post by:
Hi, Our website has recently been experiencing some problems under load. We have pinpointed a particular function which slows dramatically when we have these problems. Normally it should execute...
10
by: Eric | last post by:
Hello, I have been working through the K&R book (only chapter one so far) examples and exercises. After much sweat and hair pulling, I think I have a solution for ex 1-18 on page 31. It...
38
by: djhulme | last post by:
Hi, I'm using GCC. Please could you tell me, what is the maximum number of array elements that I can create in C, i.e. char* anArray = (char*) calloc( ??MAX?? , sizeof(char) ) ; I've...
8
by: Robert Dufour | last post by:
I been trying to look for samplecodes on how to create a simple tif file. I found a lot of commercial and stuff but I would prefer to roll my own. I only need to put some formatted text in a tif...
82
by: arnuld | last post by:
PURPOSE :: see statement in comments GOT: Segmentation Fault I guess the segfault is sourced in the compile-time warning but I am giving a char* to the function already.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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...
0
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
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...
0
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
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
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,...

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.