|
-
Jan 4th, 2001, 07:32 AM
#1
Thread Starter
Hyperactive Member
Hi,
I have a list box with items that I need to use as a WHERE clause in a SQL statement in a ASP page.
The listbox items get transfered fine using the FORM ACTION tag to the next page, where my SQL statement is at.
My problem is I need to keep track of the List box items for another 1 or 2 pages. How can I do this without using Session Variables? Inputting the values into a INPUT HIDDEN control?
Thanks for the help.
JazzBass
JazzBass
In the .NET era
Trying to remember VB6
Progress: 
XP Professional @ Home
and @ the Office
-
Jan 4th, 2001, 07:37 AM
#2
Lively Member
or session,
or submit-request it thru the pages (input type=hidden or in the querystring),
or store it in database.
you can also use coockies.
but why not use the session?
and when you finish the serial of pages, reset the session variable ur using.
itay.
-
Jan 4th, 2001, 08:07 AM
#3
Thread Starter
Hyperactive Member
Thanks Itlay
Itlay,
Thanks for the reply.
The reason I kinda don't want to use the session is because I've heard it can get messy. Oh well.
After further thinking, I think I will use the session variables.
Quick question, I'm new to ASP and was wondering what the syntax is to reset a Session Variable something like:
Session(MyVar) = ""
Please let me know.
JazzBass
JazzBass
In the .NET era
Trying to remember VB6
Progress: 
XP Professional @ Home
and @ the Office
-
Jan 4th, 2001, 08:14 AM
#4
Lively Member
you associate values (any type) to keys (strings) in the session.
Session ("KeyName") = value;
there are some messy stuff indeed with the session,
but none of those "messy" stuff will happen if you
keep it simple.
simple:
Session("SelectedOptions")="1,2,3"
Session("SelectedOptions")=""
Session("UserName")= ""+RS("UserName")
not simple:
Session("MyRecordSet") = RS;
Session("UserName") = RS("UserName"); // !!!
those are just sample, not coming to describe what
is allowed/not allowed in the session object,
but main thing, if you just store strings, there's
nothing wrong with that.
itay.
-
Jan 4th, 2001, 08:24 AM
#5
Thread Starter
Hyperactive Member
Thanks again
Ok Cool.
Thanks,
I don't think you answered my question about resetting the variables.
Do i need to say something like
Set Session(myvar) to nothing
or
Session(myvar) = ""
Please let me know.
JazzBass
JazzBass
In the .NET era
Trying to remember VB6
Progress: 
XP Professional @ Home
and @ the Office
-
Jan 4th, 2001, 08:38 AM
#6
Lively Member
you are right, but it doesn't matter.
you can always use check like this:
if (""+Session("MyKey")=="undefined")
{
// then it's undefined
}
else
{
// you can check for whatever value.
// like "done" or "1,2,3" or "no" or even "yes"
// or "undefined"
}
important to note the difference between
Session("Key")
and:
""+Session("Key")
if you always setting strings as values,
then always check for ""+Sess...
explicitly setting session variable to undefined?
i don't know how. but again, don't let this bother you.
itay.
[Edited by itay222 on 01-04-2001 at 08:42 AM]
-
Jan 4th, 2001, 08:46 AM
#7
Thread Starter
Hyperactive Member
Thank You
Itlay,
You've been a big help.
Thanks.
JazzBass
JazzBass
In the .NET era
Trying to remember VB6
Progress: 
XP Professional @ Home
and @ the Office
-
Jan 4th, 2001, 10:23 AM
#8
Frenzied Member
The problem with using the Session object variables is that it will not allow your app to scale beyond one server. If you are creating a serious web app that will receive ALOT of traffic, and require a server farm, you will not be able to use the session object because each page MUST be stateless because the load balancing software will not necessarily forward the request to the same server each time throughout a session. Since session objects are stored in a server's RAM, they are not accessable to other servers only themselves.
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
-
Jan 4th, 2001, 01:16 PM
#9
There will not be a problem using session variables in a web farm if all of the links and redirections on your pages use local paths and not full http headers:
response.redirect "/HomeDir/Login.Asp rather than
response.redirect "Http://yoursite.com/login.asp"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|