Connecting Tech Pros Worldwide Forums | Help | Site Map

Best practices for cookies in classic ASP - memory usage

MartyN
Guest
 
Posts: n/a
#1: May 30 '07
When using cookies in classic asp, is it safe to assume that using a
comma delimited list of values in one cookie is much more efficient
than using multiple cookies? (example below)

Response.Cookies("someCookie") = "101,102,103,104,105,106"
If InStr(Request.Cookies("someCookie"),"103") 0 Then.......

vs.

Response.Cookies("101") = "True"
Response.Cookies("102") = "True"
Response.Cookies("103") = "True"
Response.Cookies("104") = "True"
Response.Cookies("105") = "True"
Response.Cookies("106") = "True"
If Request.Cookies("103") = "True" Then.....


Thank you!


Anthony Jones
Guest
 
Posts: n/a
#2: May 30 '07

re: Best practices for cookies in classic ASP - memory usage



"MartyN" <MartyNg@gmail.comwrote in message
news:1180529614.119866.280390@k79g2000hse.googlegr oups.com...
Quote:
When using cookies in classic asp, is it safe to assume that using a
comma delimited list of values in one cookie is much more efficient
than using multiple cookies? (example below)
>
Response.Cookies("someCookie") = "101,102,103,104,105,106"
If InStr(Request.Cookies("someCookie"),"103") 0 Then.......
>
vs.
>
Response.Cookies("101") = "True"
Response.Cookies("102") = "True"
Response.Cookies("103") = "True"
Response.Cookies("104") = "True"
Response.Cookies("105") = "True"
Response.Cookies("106") = "True"
If Request.Cookies("103") = "True" Then.....
>
>
Thank you!
>
The former is more effecient than the latter. Whether it is 'much' more
effecient depends on the real world usage but creating multiple cookies will
increase the size the requests being made to the server.


Egbert Nierop \(MVP for IIS\)
Guest
 
Posts: n/a
#3: May 30 '07

re: Best practices for cookies in classic ASP - memory usage



"Anthony Jones" <Ant@yadayadayada.comschreef in bericht
news:O9nx6GsoHHA.4424@TK2MSFTNGP03.phx.gbl...
Quote:
>
"MartyN" <MartyNg@gmail.comwrote in message
news:1180529614.119866.280390@k79g2000hse.googlegr oups.com...
Quote:
>When using cookies in classic asp, is it safe to assume that using a
>comma delimited list of values in one cookie is much more efficient
>than using multiple cookies? (example below)
>>
>Response.Cookies("someCookie") = "101,102,103,104,105,106"
>If InStr(Request.Cookies("someCookie"),"103") 0 Then.......
>>
>vs.
>>
>Response.Cookies("101") = "True"
>Response.Cookies("102") = "True"
>Response.Cookies("103") = "True"
>Response.Cookies("104") = "True"
>Response.Cookies("105") = "True"
>Response.Cookies("106") = "True"
>If Request.Cookies("103") = "True" Then.....
>>
>>
>Thank you!
>>
>
The former is more effecient than the latter. Whether it is 'much' more
effecient depends on the real world usage but creating multiple cookies
will
increase the size the requests being made to the server.
Hi!

In fact, each separate cookie is just one line in the HTML document as a
pre-content HTML-header. This is defined in RFC's and does not cost a lot
more resources or CPU.
It does not do a separate Server request (HTTP)
HOwever, since ASP is a script language, theoretically a Request.Cookies
statement is slower than a single Request.Cookies statement which can be
splitted into an array.
I would just choose the most convenient way of programming!

The most performance scalability is gotten by desiging good SQL scripts and
commands.
--
compatible web farm Session replacement for Asp and Asp.Net
http://www.nieropwebconsult.nl/asp_session_manager.htm

Closed Thread