473,396 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Cookie and Webpage Question

Hi,

Upon login into my application I stored user data (userid, ...) in a cookie
to be used throughout the application. One particular form is very
complicated that uses AJAX and many AJAX postbacks it needs data from that
cookie. Is it bad practice to keep opening that cookie to get data each
request or should I store it (hidden fields ...)? In the future this
application will be on multiple webservers (replicated with a load balancer
in front) so my options are limited. I chose not to go with storing session
state in SQL DB because of performance issues. I have a small amount of
data that I need to store per session which can be stored in a cookie and it
is a simple solution. Any suggestions?

Thanks
Dec 7 '06 #1
3 1200
"Mike" <mi***@mike.comwrote in message
news:Oj**************@TK2MSFTNGP04.phx.gbl...
Upon login into my application I stored user data (userid, ...) in a
cookie to be used throughout the application.
Hmm...
One particular form is very complicated that uses AJAX and many AJAX
postbacks it needs data from that cookie. Is it bad practice to keep
opening that cookie to get data each request or should I store it (hidden
fields ...)?
Why can't you use use ViewState? Read the cookie when the page first loads
and cache it in ViewState.
In the future this application will be on multiple webservers (replicated
with a load balancer in front) so my options are limited.
In what way(s) are your options limited...? You're talking about non-sticky
sessions...? There are plenty of solutions for that...

http://www.microsoft.com/technet/arc....mspx?mfr=true
http://www.microsoft.com/technet/pro.../webclust.mspx
http://technet2.microsoft.com/Window....mspx?mfr=true
I chose not to go with storing session state in SQL DB because of
performance issues.
Performance issues...?
I have a small amount of data that I need to store per session which can
be stored in a cookie and it is a simple solution.
Presumably this is a public website? What are you going to do if people have
disabled cookes...?
Any suggestions?
Use sticky sessions.
Dec 7 '06 #2
Mark,

Thanks for the post. I am assuming that what you mean by sticky sessions is
use ASP.Net Session state InProc mode. This method is not scalable and I do
not want to force my user to access the same webserver (it kind of defeats
the purpose). You do make a good point about cookies and probably should
use a different method. I really do not want to store session state in a
SQL DB because:

1) I am not storing a lot of data
2) Not scalable
3) Performance

I will continue to look into session state.

Thanks

"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
"Mike" <mi***@mike.comwrote in message
news:Oj**************@TK2MSFTNGP04.phx.gbl...
>Upon login into my application I stored user data (userid, ...) in a
cookie to be used throughout the application.

Hmm...
>One particular form is very complicated that uses AJAX and many AJAX
postbacks it needs data from that cookie. Is it bad practice to keep
opening that cookie to get data each request or should I store it (hidden
fields ...)?

Why can't you use use ViewState? Read the cookie when the page first loads
and cache it in ViewState.
>In the future this application will be on multiple webservers (replicated
with a load balancer in front) so my options are limited.

In what way(s) are your options limited...? You're talking about
non-sticky sessions...? There are plenty of solutions for that...

http://www.microsoft.com/technet/arc....mspx?mfr=true
http://www.microsoft.com/technet/pro.../webclust.mspx
http://technet2.microsoft.com/Window....mspx?mfr=true
>I chose not to go with storing session state in SQL DB because of
performance issues.

Performance issues...?
>I have a small amount of data that I need to store per session which can
be stored in a cookie and it is a simple solution.

Presumably this is a public website? What are you going to do if people
have disabled cookes...?
>Any suggestions?

Use sticky sessions.

Dec 7 '06 #3
"Mike" <mi***@mike.comwrote in message
news:Oa**************@TK2MSFTNGP02.phx.gbl...
Thanks for the post. I am assuming that what you mean by sticky sessions
is use ASP.Net Session state InProc mode.
No - check the links I posted previously.
I do not want to force my user to access the same webserver
It's not user-specific - it's session-specific i.e. user connects, a session
is created and that session is handled by the same webserver in the cluster
/ farm until it is torn down, but next time the user connects, they may very
well get routed to a different webserver in the cluster / farm...
(it kind of defeats the purpose).
How so...?
I really do not want to store session state in a SQL DB because:
1) I am not storing a lot of data
Irrelevant.
2) Not scalable
Not true.
3) Performance
Not true.
Dec 7 '06 #4

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

Similar topics

6
by: Ajay | last post by:
hi! i am printing a simple cookie, but instead of printing um=name:blah&access:admin&exp:2312390.909 its printing um="name:blah&access:admin&exp:2312390.909" why the quotes?
3
by: Song Zhang | last post by:
I have two webpage, one is http://appA.mycompany.com/first.html and the other is http://appB.mycompany.com/second.html When a user visits first.html, he may click a button A, which launches...
1
by: Display Name | last post by:
Used one of these canned scripts to set up a JS quiz but not before having used another canned PHP script for "Tell your friend about this Web page!" sort of thing. Now i've gotta integrate them;...
0
by: Derek Jo | last post by:
I am currently using WebBrowser to navigate to a page which require cookies (username and usertype). What I am going to do is, when user click the button, I will popup WebBrowser and navigate to...
12
by: Jason Shohet | last post by:
I've asked this on the asp ng, but couldn't get any advice, wondering if anyone here can help... GOAL: place a .NET cookie, in a user's cookie folder, containing the machinename of the current...
15
by: Edwin Knoppert | last post by:
I have searched but info is limitted. In my test app i used a non persistant cookie for forms authentication. slidingExpiration is set to true On run and close and rerun the login remains ok....
5
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, Is there an easier way to handle that? I used Javascript to handle this when our two domains are hosted on two different servers(on different networks) and our search engine marketing...
16
by: Stevo | last post by:
I'm guessing this is a laughably obvious answer to many here, but it's not to me (and I don't have a server or any knowledge of PHP to be able to try it). It's not strictly a PHP question, but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.