loop though session

R

Ray at

Dim ajs8ejfajshdfklhas734ur
For Each ajs8ejfajshdfklhas734ur In Session.Contents
Response.Write ajs8ejfajshdfklhas734ur & " = " &
Session(ajs8ejfajshdfklhas734ur) & "<br>"
Next

Ray at work
 
E

Evertjan.

Aaron wrote on 27 okt 2003 in microsoft.public.inetserver.asp.general:
Is there a way I can loop through everything that is in session?

<% For each d in Session.Contents %>
<%=d%>
=
<%=Session.Contents(d)%>
<br>
<% Next %>
 
A

Aaron

thanks.

Evertjan. said:
Aaron wrote on 27 okt 2003 in microsoft.public.inetserver.asp.general:




<% For each d in Session.Contents %>
<%=d%>
=
<%=Session.Contents(d)%>
<br>
<% Next %>
 
E

Evertjan.

Peter Foti wrote on 27 okt 2003 in
microsoft.public.inetserver.asp.general:
Avoid this method, as it is unnecessarily inefficient. With the
approach above, the ASP interpretter will need to switch back and
forth between HTML and ASP. The other approaches posted don't.

I agree it is inefficient in CPU time and before IIS 5. The searching for
an unknown sesssionvariable name as such is terribly inefficient, as you
should know that in your own environment. If you get an unknown session
variable, how the hell would you know what to do with it, code wise?

But it is very efficient educational wise,
as, in my view, it is much easier to see the code flow
than with response.write and lots of &&& and """.

And as this code will probably only be used in an debugging environment,
the cpu efficiency is rather or rather completely unimportant.
 
J

Jason Chan

Ray at said:
Dim ajs8ejfajshdfklhas734ur
For Each ajs8ejfajshdfklhas734ur In Session.Contents
Response.Write ajs8ejfajshdfklhas734ur & " = " &
Session(ajs8ejfajshdfklhas734ur) & "<br>"
Next

Ray at work
 
H

Harag

Ray could you explain why its not an issue with iis5+ or at least
point us to some urls exaplaining why.

I was looking at a site called "coveryourasp.com" which says that
switching between asp & html is a bad thing and that he does his site
all using response.write (or a cutdown version called "Out", example
below)

What you think to this sort of design for the site? please take a look
at his and let me know your thoughts.

Al.



SUB out (sText)
response.write sText
END SUB

Out "<html><title></title><body>"
out "<table>"
out "<tr><th>head1</th><th>head2</th></tr>
out "<tr><td>1</td><td>2</td></tr>
out "<tr><td>1</td><td>2</td></tr>
out "<tr><td>1</td><td>2</td></tr>
out "</table>"
Out "</body></html>"

etc
 
R

Ray at

Harag said:
Ray could you explain why its not an issue with iis5+ or at least
point us to some urls exaplaining why.

I don't have any links. This is just one of those things that I've heard
enough times that I've chosen to believe it. I do believe that I've seen
links about some differences betweeh IIS4 and 5 and why and how 5+ handles
things differently.

I was looking at a site called "coveryourasp.com" which says that
switching between asp & html is a bad thing and that he does his site
all using response.write (or a cutdown version called "Out", example
below)

What you think to this sort of design for the site? please take a look
at his and let me know your thoughts.


I like both ways. And I like to know [believe] that I can choose either way
without it mattering. I use both ways depending on the situation. If I
just need to response.write "<option>" & val & "</option>", I'll often
response.write it. But if I'm throwing asp vars into what is mostly html, I
will <%= %> it in the html.

Ray at work
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,188
Latest member
Crypto TaxSoftware

Latest Threads

Top