Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Sessions


Message #1 by "Brad Libby" <libby_brad@b...> on Wed, 13 Sep 2000 05:09:22 +0100
I am trying to store data from a form in session level variables.

on the first page the user enters data then it is sent to the next page.



here the data is validated server-side, if the data is valid it is

displayed back to the user for confirmation..



at this point i want to establish mulitple session level varibles holding

data from each field from the previous page.  I want to do this so i can

call back the data on the following page.



the following page grabs the data from session and then puts it in the

database..



For some reason i can get the sessions to store data.



on the second page the data is retrieved from the form as follows

fname=request.form("fname")

lname=request.form("lname")

company=request.form("company")

user=request.form("username")

password=request.form("password")

repassword=request.form("repassword")

email=request.form("email")

address=request.form("address")

city=request.form("city")

state=request.form("state")

country=request.form("country")

zip=request.form("zip")

telephone=request.form("telephone")

fax=request.form("fax")

icq=request.form("icq")

company=request.form("company")

age=request.form("age")

income=request.form("income")

gender=request.form("sex")



then displayed to the user

then put in session varibles



session("exists") = true   (i use this to check on the following page that

the user has fulled out the form)

session("fname")= fname

session("lname")=  lname  

 session("company")=  company  

 session("username")=  username  

 session("password")=  password  

 session("repassword")=  repassword  

 session("email")=  email  

 session("address")=  address  

 session("city")=  city  

 session("state")=  state  

 session("country")=  country  

 session("zip")=  zip  

 session("telephone")=  telephone  

 session("fax")=  fax  

 session("icq")=  icq  

 session("company")=  company  

 session("age")=  age  

 session("income")=  income  

 session("sex")=  gender  





but on the next page when i ask to retrieve the info from the session like

this



session.contents("fname") = fname

session.contents("lname") = lname

session.contents("company")=company

session.contents("username")=username

session.contents("password")=password

session.contents("repassword")=repassword

session.contents("email")=email

session.contents("address")=address

session.contents("city")=city

session.contents("state")=state

session.contents("country")=country

session.contents("zip")=zip

session.contents("telephone")=telephone

session.contents("fax")=fax

session.contents("icq")=icq

session.contents("company")=company

session.contents("age")=age

session.contents("income")=income

session.contents("sex")=gender



The varibles are empty.. I have tryed to experiment by "response.write"

the varible and all i get is empty strings.



If you want to check this craziness out for yourself go here

www.motorbrain.com/register/index.asp



Thanks

brad

Message #2 by Yoram Zehavi <YoramZ@i...> on Wed, 13 Sep 2000 11:01:59 +0200
it should be oposite...

fname = session.contents("fname")

lname = session.contents("lname")



-----Original Message-----

From: Brad Libby [mailto:libby_brad@b...]

Sent: Wednesday, September 13, 2000 6:09 AM

To: ASP Databases

Subject: [asp_databases] Sessions





I am trying to store data from a form in session level variables.

on the first page the user enters data then it is sent to the next page.



here the data is validated server-side, if the data is valid it is

displayed back to the user for confirmation..



at this point i want to establish mulitple session level varibles holding

data from each field from the previous page.  I want to do this so i can

call back the data on the following page.



the following page grabs the data from session and then puts it in the

database..



For some reason i can get the sessions to store data.



on the second page the data is retrieved from the form as follows

fname=request.form("fname")

lname=request.form("lname")

company=request.form("company")

user=request.form("username")

password=request.form("password")

repassword=request.form("repassword")

email=request.form("email")

address=request.form("address")

city=request.form("city")

state=request.form("state")

country=request.form("country")

zip=request.form("zip")

telephone=request.form("telephone")

fax=request.form("fax")

icq=request.form("icq")

company=request.form("company")

age=request.form("age")

income=request.form("income")

gender=request.form("sex")



then displayed to the user

then put in session varibles



session("exists") = true   (i use this to check on the following page that

the user has fulled out the form)

session("fname")= fname

session("lname")=  lname  

 session("company")=  company  

 session("username")=  username  

 session("password")=  password  

 session("repassword")=  repassword  

 session("email")=  email  

 session("address")=  address  

 session("city")=  city  

 session("state")=  state  

 session("country")=  country  

 session("zip")=  zip  

 session("telephone")=  telephone  

 session("fax")=  fax  

 session("icq")=  icq  

 session("company")=  company  

 session("age")=  age  

 session("income")=  income  

 session("sex")=  gender  





but on the next page when i ask to retrieve the info from the session like

this



session.contents("fname") = fname

session.contents("lname") = lname

session.contents("company")=company

session.contents("username")=username

session.contents("password")=password

session.contents("repassword")=repassword

session.contents("email")=email

session.contents("address")=address

session.contents("city")=city

session.contents("state")=state

session.contents("country")=country

session.contents("zip")=zip

session.contents("telephone")=telephone

session.contents("fax")=fax

session.contents("icq")=icq

session.contents("company")=company

session.contents("age")=age

session.contents("income")=income

session.contents("sex")=gender



The varibles are empty.. I have tryed to experiment by "response.write"

the varible and all i get is empty strings.



If you want to check this craziness out for yourself go here

www.motorbrain.com/register/index.asp



Thanks

brad



---

You are currently subscribed to asp_databases 


Message #3 by "Ken Schaefer" <ken@a...> on Wed, 13 Sep 2000 19:22:39 +1000
Brad, I think the use of session variables is a bad idea...but having said

that, this part is where I think you're tripping up:



> session("fname")= fname

> session("lname")=  lname

...



above you are assigning the variables to session variables.



> session.contents("fname") = fname

> session.contents("lname") = lname

...



above you want to get them out again. You need to do it this way:



fname = session("fname")

Response.Write(fname)



HTH



Cheers

Ken





----- Original Message -----

From: "Brad Libby" <libby_brad@b...>

To: "ASP Databases" <asp_databases@p...>

Sent: Wednesday, September 13, 2000 2:09 PM

Subject: [asp_databases] Sessions





> I am trying to store data from a form in session level variables.

> on the first page the user enters data then it is sent to the next page.

>

> here the data is validated server-side, if the data is valid it is

> displayed back to the user for confirmation..

>

> at this point i want to establish mulitple session level varibles holding

> data from each field from the previous page.  I want to do this so i can

> call back the data on the following page.

>

> the following page grabs the data from session and then puts it in the

> database..

>

> For some reason i can get the sessions to store data.

>

> on the second page the data is retrieved from the form as follows

> fname=request.form("fname")

> lname=request.form("lname")

> company=request.form("company")

> user=request.form("username")

> password=request.form("password")

> repassword=request.form("repassword")

> email=request.form("email")

> address=request.form("address")

> city=request.form("city")

> state=request.form("state")

> country=request.form("country")

> zip=request.form("zip")

> telephone=request.form("telephone")

> fax=request.form("fax")

> icq=request.form("icq")

> company=request.form("company")

> age=request.form("age")

> income=request.form("income")

> gender=request.form("sex")

>

> then displayed to the user

> then put in session varibles

>

> session("exists") = true   (i use this to check on the following page that

> the user has fulled out the form)

> session("fname")= fname

> session("lname")=  lname

>  session("company")=  company

>  session("username")=  username

>  session("password")=  password

>  session("repassword")=  repassword

>  session("email")=  email

>  session("address")=  address

>  session("city")=  city

>  session("state")=  state

>  session("country")=  country

>  session("zip")=  zip

>  session("telephone")=  telephone

>  session("fax")=  fax

>  session("icq")=  icq

>  session("company")=  company

>  session("age")=  age

>  session("income")=  income

>  session("sex")=  gender

>

>

> but on the next page when i ask to retrieve the info from the session like

> this

>

> session.contents("fname") = fname

> session.contents("lname") = lname

> session.contents("company")=company

> session.contents("username")=username

> session.contents("password")=password

> session.contents("repassword")=repassword

> session.contents("email")=email

> session.contents("address")=address

> session.contents("city")=city

> session.contents("state")=state

> session.contents("country")=country

> session.contents("zip")=zip

> session.contents("telephone")=telephone

> session.contents("fax")=fax

> session.contents("icq")=icq

> session.contents("company")=company

> session.contents("age")=age

> session.contents("income")=income

> session.contents("sex")=gender

>

> The varibles are empty.. I have tryed to experiment by "response.write"

> the varible and all i get is empty strings.

>

> If you want to check this craziness out for yourself go here

> www.motorbrain.com/register/index.asp

>

> Thanks

> brad





Message #4 by Imar Spaanjaars <Imar@S...> on Wed, 13 Sep 2000 10:05:19 +0200
How about the following code?? I'd say you are re-assigning values to the 

session variables, instead of retrieving them



>session.contents("fname") = fname

>session.contents("lname") = lname

>session.contents("company")=company



>session.contents("username")=username

>session.contents("password")=password



This actually says: The session variable "fname" gets the value of "normal" 

variable "fname"



Try this instead:



fNameLocal = Session("fname")



That should do the trick.



But beware: Storing session variables is considered EVIL. The session devil 

itself will follow you for the rest of your life ans screw you up ;-).



Why not store this stuff in a database, and retrieve it when necessary. Or 

pass it from page to page with hidden fields. I have difficulty to 

understand why on earth you would want to store a Zip and an age for the 

life time of the session. This isn't gonna help performance.



Imar







At 05:09 AM 9/13/2000 +0100, you wrote:

>I am trying to store data from a form in session level variables.

>on the first page the user enters data then it is sent to the next page.

>

>here the data is validated server-side, if the data is valid it is

>displayed back to the user for confirmation..

>

>at this point i want to establish mulitple session level varibles holding

>data from each field from the previous page.  I want to do this so i can

>call back the data on the following page.

>

>the following page grabs the data from session and then puts it in the

>database..

>

>For some reason i can get the sessions to store data.

>

>on the second page the data is retrieved from the form as follows

>fname=request.form("fname")

>lname=request.form("lname")

>company=request.form("company")

>user=request.form("username")

>password=request.form("password")

>repassword=request.form("repassword")

>email=request.form("email")

>address=request.form("address")

>city=request.form("city")

>state=request.form("state")

>country=request.form("country")

>zip=request.form("zip")

>telephone=request.form("telephone")

>fax=request.form("fax")

>icq=request.form("icq")

>company=request.form("company")

>age=request.form("age")

>income=request.form("income")

>gender=request.form("sex")

>

>then displayed to the user

>then put in session varibles

>

>session("exists") = true   (i use this to check on the following page that

>the user has fulled out the form)

>session("fname")= fname

>session("lname")=  lname

>  session("company")=  company

>  session("username")=  username

>  session("password")=  password

>  session("repassword")=  repassword

>  session("email")=  email

>  session("address")=  address

>  session("city")=  city

>  session("state")=  state

>  session("country")=  country

>  session("zip")=  zip

>  session("telephone")=  telephone

>  session("fax")=  fax

>  session("icq")=  icq

>  session("company")=  company

>  session("age")=  age

>  session("income")=  income

>  session("sex")=  gender

>

>

>but on the next page when i ask to retrieve the info from the session like

>this

>

>session.contents("fname") = fname

>session.contents("lname") = lname

>session.contents("company")=company

>session.contents("username")=username

>session.contents("password")=password

>session.contents("repassword")=repassword

>session.contents("email")=email

>session.contents("address")=address

>session.contents("city")=city

>session.contents("state")=state

>session.contents("country")=country

>session.contents("zip")=zip

>session.contents("telephone")=telephone

>session.contents("fax")=fax

>session.contents("icq")=icq

>session.contents("company")=company

>session.contents("age")=age

>session.contents("income")=income

>session.contents("sex")=gender

>

>The varibles are empty.. I have tryed to experiment by "response.write"

>the varible and all i get is empty strings.

>

>If you want to check this craziness out for yourself go here

>www.motorbrain.com/register/index.asp

>

>Thanks

>brad

>

>---

>You are currently subscribed to asp_databases






Message #5 by =?iso-8859-1?Q?Gonzalo_Ruiz_de_Villa_Su=E1rez?= <gonzalo.ruizdevilla@a...> on Wed, 13 Sep 2000 10:09:15 +0200
If you want to retrieve session variables try





 fname = session.contents("fname")

 lname = session.contents("lname")

...



Or





 fname = session("fname")

 lname = session ("lname")

...





Instead of



session.contents("fname") = fname

session.contents("lname") = lname

...







Regards,

Gonzalo



Message #6 by Imar Spaanjaars <Imar@S...> on Wed, 13 Sep 2000 10:09:44 +0200
P.S. If you say (in the page you mention) "Please use your browser's back 

button to correct these errors", you better enable page caching. When I 

press back, the whole page is reloaded, so none of my fields are still 

filled / re-filled. If I make an error I have to fill the whole form again.



Just my 2 cents.....





Imar





At 05:09 AM 9/13/2000 +0100, you wrote:

>I am trying to store data from a form in session level variables.

>on the first page the user enters data then it is sent to the next page.

>

>here the data is validated server-side, if the data is valid it is

>displayed back to the user for confirmation..

>

>at this point i want to establish mulitple session level varibles holding

>data from each field from the previous page.  I want to do this so i can

>call back the data on the following page.

>

>the following page grabs the data from session and then puts it in the

>database..





Message #7 by smartin@c... on Wed, 13 Sep 2000 10:49:32 -0400
> From: Imar Spaanjaars [mailto:Imar@S...]



> But beware: Storing session variables is considered EVIL. The 

> session devil 

> itself will follow you for the rest of your life ans screw you up ;-).

> 



Nice blanket statement...



Contrary to popular opinion/myth, there are situations where using Session

variables is the *best* way to go.  There are times when storing temp

variables in a database is overkill.  It all depends on what the application

is doing.



I'd be interested in seeing some supporting documentation that storing

Session variables is considered EVIL.  Yes, I know there are issues with

Session variables and scalability, etc.  I've seen those documents.  But I

truly wonder how many ASP "developers" truly understand when and where

Sessions are inappropriate and how many are just quoting something as a

"truth" even if they have no understanding of why it is a truth.



Stephen Martin

Chief Web Architect

Public Access Technologies

Fairfax County, Virginia

http://www.co.fairfax.va.us

Message #8 by Imar Spaanjaars <Imar@S...> on Wed, 13 Sep 2000 18:05:10 +0200
--=====================_21552240==_

Content-Type: text/plain; charset="us-ascii"; format=flowed



You are right about the fact that sometimes session vars are the way to go.

See the thing is, I think that only people that know the consequences about 

sessions will say they are evil. In my opinion, this is just to scare off 

people who don't fully understand.



Of course we all use them in certain situations because they can be really 

handy and help to build your application rapidly.



But you definitely have to be aware of what they do, what they "cost" and 

how they limit you.

It's generally easier to advise people against using session variables 

altogether than to explain all the consequences. If people try to find 

other solutions for storing a single integer they will certainly not store 

a record set in a session variable.



But I also know of enough situations where I certainly won't use sessions, 

and I am not "quoting something as a truth" which by the way is not a very 

nice thing to imply.....

I won't go into any Yes-No stuff about whether I actually do or don't know 

what I am talking about.



See for yourself. Use them if you like and can, avoid them if you can.... ;-)





Imar









At 10:49 AM 9/13/2000 -0400, you wrote:

> > From: Imar Spaanjaars [mailto:Imar@S...]

>

> > But beware: Storing session variables is considered EVIL. The

> > session devil

> > itself will follow you for the rest of your life ans screw you up ;-).

> >

>

>Nice blanket statement...

>

>Contrary to popular opinion/myth, there are situations where using Session

>variables is the *best* way to go.  There are times when storing temp

>variables in a database is overkill.  It all depends on what the application

>is doing.

>

>I'd be interested in seeing some supporting documentation that storing

>Session variables is considered EVIL.  Yes, I know there are issues with

>Session variables and scalability, etc.  I've seen those documents.  But I

>truly wonder how many ASP "developers" truly understand when and where

>Sessions are inappropriate and how many are just quoting something as a

>"truth" even if they have no understanding of why it is a truth.

>

>Stephen Martin

>Chief Web Architect

>Public Access Technologies

>Fairfax County, Virginia

>http://www.co.fairfax.va.us

>

>---

>You are currently subscribed to asp_databases




--=====================_21552240==_

Content-Type: application/octet-stream; name="Prisma Elektronisch Woordenboek Engels.lnk"

Content-Transfer-Encoding: base64

Content-Disposition: attachment; filename="Prisma Elektronisch Woordenboek Engels.lnk"



TAAAAAEUAgAAAAAAwAAAAAAAAEb7QAAAIAAAALCX92kMDMABEMulagwMwAEAB9oqgsK8AQBqHgAA

AAAAAQAAAAAAAAAAAAAAAAAAAIYAFAAfUOBP0CDqOmkQotgIACswMJ0ZACNGOlwAAAAAAAAAAAAA

AAAAAAAAAAWiJQAxAAAAAAAWKS09MQBQcm9ncmFtIEZpbGVzAFBST0dSQX4xABYAMQAAAAAAFik2

PRAAUFJJU01BAAAcADIAAGoeADAj6UogAENPTVBMRVgzLkVYRQAAAABdAAAAHAAAAAEAAAAcAAAA

NwAAAAAAAABcAAAAGwAAAAMAAADui08sEAAAAFdJTk5UXzIwMDAARjpcUHJvZ3JhbSBGaWxlc1xQ

UklTTUFcQ09NUExFWDMuRVhFAAAwAC4ALgBcAC4ALgBcAC4ALgBcAC4ALgBcAC4ALgBcAFAAcgBv

AGcAcgBhAG0AIABGAGkAbABlAHMAXABQAFIASQBTAE0AQQBcAEMATwBNAFAATABFAFgAMwAuAEUA

WABFABIAZgA6AFwAcAByAG8AZwByAGEAfgAxAFwAUAByAGkAcwBtAGEAJwBmADoAXABwAHIAbwBn

AHIAYQB+ADEAXABQAHIAaQBzAG0AYQBcAHAAZQB3AGUAbgBnAC4AYQBiAHMAIABwAGUAdwBuAGUA

LgBhAG4AZAAfAGYAOgBcAHAAcgBvAGcAcgBhAH4AMQBcAFAAcgBpAHMAbQBhAFwAcwBwAGUAYwB0

AHIAdQBtAC4AaQBjAG8AFAMAAAcAAKAlU3lzdGVtRHJpdmUlXHByb2dyYX4xXFByaXNtYVxzcGVj

dHJ1bS5pY28AAHIAbwBnAHIAYQB+ADEAXABQAHIAaQBzAG0AYQBcAHAAZQB3AGUAbgBnAC4AYQBi

AHMAIABwAGUAdwBuAGUALgBhAG4AZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAAAAAAAAA5gYAEwAAAHEj+HcYCgcAAAAHABMAAAAIoBEA2OUGAIAGAACQ

5wYARZD7d7Aj+Hf/////oOcGAACh/HcYCgcAAAAAAEgAAABXUuh3AAAAAAAAAAAAAAAAAAAAACUA

UwB5AHMAdABlAG0ARAByAGkAdgBlACUAXABwAHIAbwBnAHIAYQB+ADEAXABQAHIAaQBzAG0AYQBc

AHMAcABlAGMAdAByAHUAbQAuAGkAYwBvAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

AAAAAAAAAAAAAAAAAAAAANzmBgAAAAAA0iL4dwAABwAAoAwAAAAAALjmBgCIBgcAbOcGAEWQ+3fw

Ivh3COcGAAAAAADSIvh3AAAHAACgEQAAAAAA5OYGAIgGBwCY5wYARZD7d/Ai+Hf/////qOcGAOCl

/HcYCgcACKARAAigEQBIAAAACKARAAEAAAAAAAAAgOcGAAAAAADYXf9wyF3/cAjlBgAAkPt3AAAH

AAAABwAAAAAAZFf4d2jnBgAA6gYAEwAAAAigDAAzAADAeOcGAAAAAAAUR/h3AAAHABMAAAAAoBEA

mAAAADMAAMAB/gYAtP4GABjnBgC0/gYA4OcGAEWQ+3eAH/h3//////DnBgAwM+h3AAAHAAAAAAAI

oBEACKARAEgAAAC8Uuh3CKARAEgAAAC8Uuh3yOcGALznBgC0/gYAtP4GAL7c6XdQNOh3/////zzs

BgD0Y4BpCKARAATeDgCIuBIACAIAAGYAOgBcAHAAcgBvAGcAcgBhAH4AMQBcAFAAcgBpAHMAbQBh

AFwAQwAQAAAABQAAoCYAAABSAAAAYAAAAAMAAKBYAAAAAAAAAHByaXZlAAAAAAAAAAAAAAAQAgBZ

k1jRRZlU0yeqgq3UwJEJqv931BGacQAgGC87dhACAFmTWNFFmVTTJ6qCrdTAkQmq/3fUEZpxACAY

Lzt2AAAAAA==

--=====================_21552240==_

Content-Type: text/plain; charset="us-ascii"; format=flowed





--=====================_21552240==_--



Message #9 by "Ken Schaefer" <ken@a...> on Thu, 14 Sep 2000 12:08:32 +1000
Stephen,



For the application that was mentioned, simply having hidden "form" fields,

and reposting would have been sufficient. Why create 20 odd session

variables for each user? When the variables are only going to be carried

over one page? When they are not going to be used again?



I use session variables in smallish sites, especially for the

"administration" sections, eg to maintain login status and access rights

information. But these are usually "controlled" areas where I know

beforehand how many users there will be (ie the number of web site

administrators isn't going to grow from 5 to 5000 overnight) and that their

computers will support cookies.



For a public site, eg a shopping cart, I would avoid session variable use

except in very limited ways.

What happens if your daily traffic goes from 5 users to 5000 users? You just

don't know if that's not going to happen. All that has to happen is that

your PR department is 100 times more succesful than you envisaged, and boom,

your site is shot to crap. Even if it doesn't happen overnight, even if it

happens over 6 months, or 12 months, do you really want to go around

recoding everything to get rid of the excessive session variable dependancy?



That said I agree, storing temporary data in a database is overkill

sometimes, in which case you can use cookies, or at a pinch, hidden form

fields or session variables to maintain the data. However I don't think the

situation that was original mentioned is a candidate for the use of session

variables.



Cheers

Ken





----- Original Message -----

From: <smartin@c...>

To: "ASP Databases" <asp_databases@p...>

Sent: Thursday, September 14, 2000 12:49 AM

Subject: [asp_databases] Re: Sessions





> > From: Imar Spaanjaars [mailto:Imar@S...]

>

> > But beware: Storing session variables is considered EVIL. The

> > session devil

> > itself will follow you for the rest of your life ans screw you up ;-).

> >

>

> Nice blanket statement...

>

> Contrary to popular opinion/myth, there are situations where using Session

> variables is the *best* way to go.  There are times when storing temp

> variables in a database is overkill.  It all depends on what the

application

> is doing.

>

> I'd be interested in seeing some supporting documentation that storing

> Session variables is considered EVIL.  Yes, I know there are issues with

> Session variables and scalability, etc.  I've seen those documents.  But I

> truly wonder how many ASP "developers" truly understand when and where

> Sessions are inappropriate and how many are just quoting something as a

> "truth" even if they have no understanding of why it is a truth.

>

> Stephen Martin

> Chief Web Architect

> Public Access Technologies

> Fairfax County, Virginia

> http://www.co.fairfax.va.us





Message #10 by "=?iso-8859-9?B?QWhtZXQgR/xuZf4=?=" <gunesahm@a...> on Thu, 14 Sep 2000 16:45:49 +0300
I think there is a mistake in retrieving the session variables..



The Left and Right hand side of the below equations must be reversed...



as



fname = session.contents("fname")

lname = session.contents("lname")

company = session.contents("company")

...etc.



Then you can check for the values

by Response.write(fname & " " & lname & ...)



-------------------------------------------

session.contents("fname") = fname

session.contents("lname") = lname

session.contents("company")=company

session.contents("username")=username

session.contents("password")=password

session.contents("repassword")=repassword

session.contents("email")=email

session.contents("address")=address

session.contents("city")=city

session.contents("state")=state

session.contents("country")=country

session.contents("zip")=zip

session.contents("telephone")=telephone

session.contents("fax")=fax

session.contents("icq")=icq

session.contents("company")=company

session.contents("age")=age

session.contents("income")=income

session.contents("sex")=gender











-----Original Message-----

From: Brad Libby [mailto:libby_brad@b...]

Sent: 13 Eylül 2000 Çar
amba 07:09

To: ASP Databases

Subject: [asp_databases] Sessions





I am trying to store data from a form in session level variables.

on the first page the user enters data then it is sent to the next page.



here the data is validated server-side, if the data is valid it is

displayed back to the user for confirmation..



at this point i want to establish mulitple session level varibles holding

data from each field from the previous page.  I want to do this so i can

call back the data on the following page.



the following page grabs the data from session and then puts it in the

database..



For some reason i can get the sessions to store data.



on the second page the data is retrieved from the form as follows

fname=request.form("fname")

lname=request.form("lname")

company=request.form("company")

user=request.form("username")

password=request.form("password")

repassword=request.form("repassword")

email=request.form("email")

address=request.form("address")

city=request.form("city")

state=request.form("state")

country=request.form("country")

zip=request.form("zip")

telephone=request.form("telephone")

fax=request.form("fax")

icq=request.form("icq")

company=request.form("company")

age=request.form("age")

income=request.form("income")

gender=request.form("sex")



then displayed to the user

then put in session varibles



session("exists") = true   (i use this to check on the following page that

the user has fulled out the form)

session("fname")= fname

session("lname")=  lname

 session("company")=  company

 session("username")=  username

 session("password")=  password

 session("repassword")=  repassword

 session("email")=  email

 session("address")=  address

 session("city")=  city

 session("state")=  state

 session("country")=  country

 session("zip")=  zip

 session("telephone")=  telephone

 session("fax")=  fax

 session("icq")=  icq

 session("company")=  company

 session("age")=  age

 session("income")=  income

 session("sex")=  gender





but on the next page when i ask to retrieve the info from the session like

this



session.contents("fname") = fname

session.contents("lname") = lname

session.contents("company")=company

session.contents("username")=username

session.contents("password")=password

session.contents("repassword")=repassword

session.contents("email")=email

session.contents("address")=address

session.contents("city")=city

session.contents("state")=state

session.contents("country")=country

session.contents("zip")=zip

session.contents("telephone")=telephone

session.contents("fax")=fax

session.contents("icq")=icq

session.contents("company")=company

session.contents("age")=age

session.contents("income")=income

session.contents("sex")=gender



The varibles are empty.. I have tryed to experiment by "response.write"

the varible and all i get is empty strings.



If you want to check this craziness out for yourself go here

www.motorbrain.com/register/index.asp



Thanks

brad



Message #11 by smartin@c... on Thu, 14 Sep 2000 16:28:14 -0400
And I wouldn't argue with you.



My point was more that there are many new "developers" (and I use that term

lightly) who really have no understanding of the fundamentals properties,

functions, etc., involved in developing Web-based applications using ASP (pr

any other platform for that matter).  But rather than learning, they fall

back on what has been presented to them as the gospel truth, never

questioning the validity of the statements and practices they're espousing.

I know the trade-offs of using sessions and I know when I where I'd use them

and where I'd avoid them.  Given the scenario of the original question, I

agree that hidden fields would be a more appropriate approach.  I think the

issue that got me was that the statement was made by several people that

Sessions are bad without offering any idea of why (especially in reference

to this particular case) or offering any practical alternatives (and without

knowing the whole architecture involved--maybe the form is only expected to

be used by a handful of people).  Given that this list is populated by a

number of people new to ASP development, I would hope that the more

experienced ASP developers on this list would take the time to explain why

rather than just pronouncing fait accompli.



-Stephen



> -----Original Message-----

> From: Ken Schaefer [mailto:ken@a...]

> Sent: Wednesday, September 13, 2000 10:09 PM

> To: ASP Databases

> Subject: [asp_databases] Re: Sessions

> 

> 

> Stephen,

> 

> For the application that was mentioned, simply having hidden 

> "form" fields,

> and reposting would have been sufficient. Why create 20 odd session

> variables for each user? When the variables are only going to 

> be carried

> over one page? When they are not going to be used again?

> 

> I use session variables in smallish sites, especially for the

> "administration" sections, eg to maintain login status and 

> access rights

> information. But these are usually "controlled" areas where I know

> beforehand how many users there will be (ie the number of web site

> administrators isn't going to grow from 5 to 5000 overnight) 

> and that their

> computers will support cookies.

> 

> For a public site, eg a shopping cart, I would avoid session 

> variable use

> except in very limited ways.

> What happens if your daily traffic goes from 5 users to 5000 

> users? You just

> don't know if that's not going to happen. All that has to 

> happen is that

> your PR department is 100 times more succesful than you 

> envisaged, and boom,

> your site is shot to crap. Even if it doesn't happen 

> overnight, even if it

> happens over 6 months, or 12 months, do you really want to go around

> recoding everything to get rid of the excessive session 

> variable dependancy?

> 

> That said I agree, storing temporary data in a database is overkill

> sometimes, in which case you can use cookies, or at a pinch, 

> hidden form

> fields or session variables to maintain the data. However I 

> don't think the

> situation that was original mentioned is a candidate for the 

> use of session

> variables.

> 

> Cheers

> Ken

> 

> 

> ----- Original Message -----

> From: <smartin@c...>

> To: "ASP Databases" <asp_databases@p...>

> Sent: Thursday, September 14, 2000 12:49 AM

> Subject: [asp_databases] Re: Sessions

> 

> 

> > > From: Imar Spaanjaars [mailto:Imar@S...]

> >

> > > But beware: Storing session variables is considered EVIL. The

> > > session devil

> > > itself will follow you for the rest of your life ans 

> screw you up ;-).

> > >

> >

> > Nice blanket statement...

> >

> > Contrary to popular opinion/myth, there are situations 

> where using Session

> > variables is the *best* way to go.  There are times when 

> storing temp

> > variables in a database is overkill.  It all depends on what the

> application

> > is doing.

> >

> > I'd be interested in seeing some supporting documentation 

> that storing

> > Session variables is considered EVIL.  Yes, I know there 

> are issues with

> > Session variables and scalability, etc.  I've seen those 

> documents.  But I

> > truly wonder how many ASP "developers" truly understand 

> when and where

> > Sessions are inappropriate and how many are just quoting 

> something as a

> > "truth" even if they have no understanding of why it is a truth.

> >

> > Stephen Martin

> > Chief Web Architect

> > Public Access Technologies

> > Fairfax County, Virginia

> > http://www.co.fairfax.va.us

> 

> 

> 




  Return to Index