newby C# web app cookie question

  • Thread starter Thread starter Fred Nelson
  • Start date Start date
F

Fred Nelson

Hi:

I'm developing a web application that needs to have five values, each
retrieved from cookies on many pages.

If I have five "Request.Cookies" commands together does this cause five
"round trips" to the browser or am I accessing one instance.

If five round trips occur then I will develop some parsing algorithm to
save everything I need in one cookie.

Thanks for your help and suggestons!

Fred
 
The cookies are transmitted in the "cookie header," so they are all
transmitted in each request.
 
KJ:

Thanks for your reply!

Does this mean that I should have five Request.Cookies commands in a row

ex:

Request.Cookies["value1"].Value.ToString();
Request.Cookies["value2"].Value.ToString();
Request.Cookies["value3"].Value.ToString();

and not suffer a penalty

Or is there a way to perform only one request and retrive all cookies at
once?

Thanks again for your help with this "newby" question!

Fred
 
Hi, there is no penalty for accessing the Cookies object. It is already
populated when you are in the context of server-side code. Remember
that the "user agent" (a.k.a. Internet Explorer) makes the request, not
the server-side code. The server code runs in response to that request.
 

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

Back
Top