473,586 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

can Session.Content s can be a string array?

Hello,

My script builds a list of files in a folder.
These files are stored in an 2-dimensional array, called "a_files".

To speed up the script, I don't want the filelist everytime being read on
the server.
Therefore I wanted to send the contents of a_files to a session variable.

However, with
Session.Content s("sFiles") = a_files

I get the following error message:
*************** ********
Response object error 'ASP 0106 : 80020005'
Type Mismatch
?
An unhandled data type was encountered.
*************** ********

Is it impossible to store an array to a session var?
Is there another way to store the array somewhere in memory so it has not to
be rebuild everytime?

tia

bartp


--
HyperART
Paul Van Ostaijenlaan 4
3001 Heverlee
Jul 19 '05 #1
7 6779
Do this:
Session("sFiles ") = a_files

Bob Barriws

Bart Plessers (artabel) wrote:
Hello,

My script builds a list of files in a folder.
These files are stored in an 2-dimensional array, called "a_files".

To speed up the script, I don't want the filelist everytime being
read on the server.
Therefore I wanted to send the contents of a_files to a session
variable.

However, with
Session.Content s("sFiles") = a_files

I get the following error message:
*************** ********
Response object error 'ASP 0106 : 80020005'
Type Mismatch
?
An unhandled data type was encountered.
*************** ********

Is it impossible to store an array to a session var?
Is there another way to store the array somewhere in memory so it has
not to be rebuild everytime?

tia

bartp

Jul 19 '05 #2
> "Bart Plessers (artabel)" <ba**********@h otmail.com> wrote in message
news:#p******** ******@TK2MSFTN GP12.phx.gbl...
Therefore I wanted to send the contents of a_files to a session variable.

However, with
Session.Content s("sFiles") = a_files

I get the following error message:
*************** ********
Response object error 'ASP 0106 : 80020005'
Type Mismatch
?
An unhandled data type was encountered.
*************** ********

Is it impossible to store an array to a session var?
Yes, you can.<%
Dim x(2)
x(0) = "a"
x(1) = "b"
x(2) = "c"

Session("arr") = x

Response.write Session("arr")( 0)
Response.write Session("arr")( 1)
Response.write Session("arr")( 2)
%>

What is the rest of your code?
Is there another way to store the array somewhere in memory so it has not to be rebuild everytime?


A database is another option.

Ray at home

Jul 19 '05 #3

hmm,
you build the array in memory.

I have build the array in code:

'************** *************** *****
Dim a_files()
i_dim = 3 'geeft het aantal gegevens aan per j in de array. Opgelet, indien
4 gegevens nodig, dan
i_name = 0 'gives posistion in array
i_size = 1 'gives posistion in array
i_type = 2 'gives posistion in array
i_date = 3 'gives posistion in array

j = 0
For each oFile in oFiles
ReDim Preserve a_files(i_dim,j )
a_files(i_name, j) = oFile.Name
a_files(i_size, j) = oFile.Size
a_files(i_type, j) = oFile.Type
a_files(i_date, j) = oFile.DateLastM odified
j = j + 1
Next
'************** *************** *****
Then I want to pass the a_files() to a session string

Can this also be done?
Syntax if?
tia

bartp

--
HyperART
Paul Van Ostaijenlaan 4
3001 Heverlee

"Ray at home" <myfirstname at lane 34 . komm> wrote in message
news:uq******** ******@tk2msftn gp13.phx.gbl...
"Bart Plessers (artabel)" <ba**********@h otmail.com> wrote in message news:#p******** ******@TK2MSFTN GP12.phx.gbl...
Therefore I wanted to send the contents of a_files to a session variable.
However, with
Session.Content s("sFiles") = a_files

I get the following error message:
*************** ********
Response object error 'ASP 0106 : 80020005'
Type Mismatch
?
An unhandled data type was encountered.
*************** ********

Is it impossible to store an array to a session var?


Yes, you can.<%
Dim x(2)
x(0) = "a"
x(1) = "b"
x(2) = "c"

Session("arr") = x

Response.write Session("arr")( 0)
Response.write Session("arr")( 1)
Response.write Session("arr")( 2)
%>

What is the rest of your code?
Is there another way to store the array somewhere in memory so it has

not to
be rebuild everytime?


A database is another option.

Ray at home


Jul 19 '05 #4
An array is an array.
You can store it as an array in a session variable.

Bart Plessers (artabel) wrote:
hmm,
you build the array in memory.

I have build the array in code:

Jul 19 '05 #5
do you have any idea why i get the error

*************** ********
Response object error 'ASP 0106 : 80020005'
Type Mismatch
?
An unhandled data type was encountered.
*************** ********

Session.Content s("sFiles") = a_files
Do I have do Dim the sFiles before?

--

=============== =============== ============
Hyper A.R.T.
bart plessers
Paul Van Ostaijenlaan 4
3001 Heverlee
BELGIUM
tel: +32 (16) 23.40.85
fax: +32 (16) 23.41.06
=============== =============== ============

"Bob Barrows" <re*******@yaho o.com> wrote in message
news:eO******** ******@TK2MSFTN GP10.phx.gbl...
An array is an array.
You can store it as an array in a session variable.

Bart Plessers (artabel) wrote:
hmm,
you build the array in memory.

I have build the array in code:


Jul 19 '05 #6
I don't know. I've tried your code and do not get the error. Here is what I
tried:

Dim a_files()
i_dim = 3 'geeft het aantal gegevens aan per j in de array. Opgelet, indien
4 gegevens nodig, dan
i_name = 0 'gives posistion in array
i_size = 1 'gives posistion in array
i_type = 2 'gives posistion in array
i_date = 3 'gives posistion in array
set fso=Server.Crea teObject("scrip ting.filesystem object")
set oFldr = fso.GetFolder(s erver.MapPath(" ."))
set oFiles = oFldr.Files
j = 0
For each oFile in oFiles
ReDim Preserve a_files(i_dim,j )
a_files(i_name, j) = oFile.Name
a_files(i_size, j) = oFile.Size
a_files(i_type, j) = oFile.Type
a_files(i_date, j) = oFile.DateLastM odified
j = j + 1
Next
Session.content s("arr") = a_files
for i = 0 to ubound(session( "arr"),2)
for j = 0 to ubound(session( "arr"),1)
Response.Write session("arr")( j,i) & "<BR>"
next
next

It seems like you don't have an array. Have you used IsArray to verify that
a_files is an array?

Bob Barrows

bart plessers wrote:
do you have any idea why i get the error

*************** ********
Response object error 'ASP 0106 : 80020005'
Type Mismatch
?
An unhandled data type was encountered.
*************** ********

Session.Content s("sFiles") = a_files
Do I have do Dim the sFiles before?
"Bob Barrows" <re*******@yaho o.com> wrote in message
news:eO******** ******@TK2MSFTN GP10.phx.gbl...
An array is an array.
You can store it as an array in a session variable.

Bart Plessers (artabel) wrote:
hmm,
you build the array in memory.

I have build the array in code:

Jul 19 '05 #7
bob,
STUPID ME!!!!!!!!!

sorry to bother you with this.
The problem was that -for debugging- I had included a file "_debug.asp "
In this file, there was a line :

response.write( session("SFiles "))

just becaus SFiles was an array, the response.write could not handle
this.......
anyway,
your code pointed me to reconstruct the array, and not write it itself, so
it was very helpfull!

sorry to bother you
thanx again,

bartp

--

=============== =============== ============
Hyper A.R.T.
bart plessers
Paul Van Ostaijenlaan 4
3001 Heverlee
BELGIUM
tel: +32 (16) 23.40.85
fax: +32 (16) 23.41.06
=============== =============== ============

"Bob Barrows" <re*******@yaho o.com> wrote in message
news:e8******** ******@TK2MSFTN GP10.phx.gbl...
I don't know. I've tried your code and do not get the error. Here is what I tried:

Dim a_files()
i_dim = 3 'geeft het aantal gegevens aan per j in de array. Opgelet, indien 4 gegevens nodig, dan
i_name = 0 'gives posistion in array
i_size = 1 'gives posistion in array
i_type = 2 'gives posistion in array
i_date = 3 'gives posistion in array
set fso=Server.Crea teObject("scrip ting.filesystem object")
set oFldr = fso.GetFolder(s erver.MapPath(" ."))
set oFiles = oFldr.Files
j = 0
For each oFile in oFiles
ReDim Preserve a_files(i_dim,j )
a_files(i_name, j) = oFile.Name
a_files(i_size, j) = oFile.Size
a_files(i_type, j) = oFile.Type
a_files(i_date, j) = oFile.DateLastM odified
j = j + 1
Next
Session.content s("arr") = a_files
for i = 0 to ubound(session( "arr"),2)
for j = 0 to ubound(session( "arr"),1)
Response.Write session("arr")( j,i) & "<BR>"
next
next

It seems like you don't have an array. Have you used IsArray to verify that a_files is an array?

Bob Barrows

bart plessers wrote:
do you have any idea why i get the error

*************** ********
Response object error 'ASP 0106 : 80020005'
Type Mismatch
?
An unhandled data type was encountered.
*************** ********

Session.Content s("sFiles") = a_files
Do I have do Dim the sFiles before?
"Bob Barrows" <re*******@yaho o.com> wrote in message
news:eO******** ******@TK2MSFTN GP10.phx.gbl...
An array is an array.
You can store it as an array in a session variable.

Bart Plessers (artabel) wrote:
hmm,
you build the array in memory.

I have build the array in code:


Jul 19 '05 #8

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

Similar topics

1
3266
by: Ryan Hubbard | last post by:
I've have been trying to serialize an array of objects. I can serialize and set a session variable and retrieve it successfully for a serialize string of any length within the contents of a single script. $_SESSION = serialize($b); // strlen($a) = 120,011 print unserialize($_SESSION) But if I set a session variable and then try to...
1
1885
by: Don Grover | last post by:
Does any one have an asp page they can share that returns current session details, cookies etc. I can't get session arrays to return in a page.
1
2785
by: Bart Plessers \(artabel\) | last post by:
Hello, Currently developping a site, where I use some session variables. The site is located at my home computer. Because I have a dynamic IP adress, I use no-ip (www.no-ip.org) to have my own custom domain name (pvo.no-ip.org) My ISP blocks port 80, so website runs at port 4040 The service no-ip offers "Mask / Cloaking Options": every...
6
3464
by: Colin Steadman | last post by:
I have created a function to kill all session variables that aren't in a safe list. This is the function - Sub PurgeSessionVariables For Each Item In Session.Contents Select Case Trim(Item) Case "Authenticated" Case "CI_CODE" Case "organisation_description" Case "location_description"
1
3080
by: YT | last post by:
Howdy, Why the heck wouldn't this work: for each item in Session.Contents if NOT( Instr( item, "customer_" ) = 1 OR Instr( item, "user_" ) = 1 ) Then Session.Contents( item ) = "" Session.Contents.Remove( item ) end if next 'item
1
1618
by: Dan King | last post by:
At a summary page, I am trying to clean up Session.Contents so the user can go back to the main page and not retain any unnecessary info. I have entered this into my summary page, but it seems to only eliminate every other or every third entry. If I refresh the page about 0 times everything eventually clears out. Anyone know why it would do...
9
9764
by: charliewest | last post by:
Hello - I have images saved in my SQL SERVER 2000 database. Using ASP.NET (C#) is there any way to temporarily save an image to a session object, and after running some other operations, later retrieve the image from the session object, convert it back to an image, and re-save it to the database? Thanks?
5
3172
by: TRB_NV | last post by:
I'm losing information from my Session when I change pages or start the same page over again. I simplified the code so the example is really clear. The sample code that follows is supposed to generate a random number and put it into an Array and store it in the Session variable and then when it runs the next time, generate another random...
6
17114
by: J055 | last post by:
Hi I have the following code. I upload an XML file using the FileUpload object, store the stream in a session so the user gets the chance to confirm some options then pass the stream from the Session to an XmlReader. if (performImport == false) { Session = fileUpload1.FileContent; //... some other code
0
7911
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7839
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...
0
8200
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7954
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...
0
5390
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...
0
3836
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...
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1448
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1179
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...

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.