Simple question about cookie:

  • Thread starter Ivan Demkovitch
  • Start date
I

Ivan Demkovitch

Hi!

From what I understand cookies could be persisted or in-memory.

I need to set second one...

This code:
Response.Cookies["phpbb_data"].Value = Server.UrlEncode(phpC);
Response.Cookies["phpbb_data"].Path = "/";
Response.Cookies["phpbb_data"].Expires = DateTime.Now.AddMinutes(1);

would place cookie on HDD regardless of "Expires" property (even if I don't
set it)

In MSDN I found object Cookie with property Discard. This is what I need,
but the one I use is HttpCookie.

How do I set this in-memory cookie???

Thanks!
 
K

Kevin Spencer

If you create a cookie and don't set an expiration, it will expire as soon
as the browser session ends.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
I

Ivan Demkovitch

It doesn't. It show
ExpirationDate 1/1/0001 12:00:00 AM





Kevin Spencer said:
If you create a cookie and don't set an expiration, it will expire as soon
as the browser session ends.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

Ivan Demkovitch said:
Hi!

From what I understand cookies could be persisted or in-memory.

I need to set second one...

This code:
Response.Cookies["phpbb_data"].Value = Server.UrlEncode(phpC);
Response.Cookies["phpbb_data"].Path = "/";
Response.Cookies["phpbb_data"].Expires = DateTime.Now.AddMinutes(1);

would place cookie on HDD regardless of "Expires" property (even if I don't
set it)

In MSDN I found object Cookie with property Discard. This is what I need,
but the one I use is HttpCookie.

How do I set this in-memory cookie???

Thanks!
 
B

bruce barker

how the browser remembers a cookie is browser dependant. IE always writes
the cookie to disk even if its a session cookie (no expir date)

cookies are just header records on a web request or response. when the
browser sees a cookier header in a response, it stores it for future use.
 
I

Ivan Demkovitch

Is there any way to read/write cookies "by hand" i.e. not using .NET object
but altering header directly?

I have following problem: I need to integrate PHP and ASP.NET portions of
site. I should write cookie that PHP will recognize and read/delete PHP set
cookie.

Right now I'm having really strange problems... Is it possible to have 2
cookies with the same name? When I place cookie thru asp.net php doesn't see
it and place another one and my debug page in asp.net show 2 identical
cookies...




bruce barker said:
how the browser remembers a cookie is browser dependant. IE always writes
the cookie to disk even if its a session cookie (no expir date)

cookies are just header records on a web request or response. when the
browser sees a cookier header in a response, it stores it for future use.



Ivan Demkovitch said:
Hi!

From what I understand cookies could be persisted or in-memory.

I need to set second one...

This code:
Response.Cookies["phpbb_data"].Value = Server.UrlEncode(phpC);
Response.Cookies["phpbb_data"].Path = "/";
Response.Cookies["phpbb_data"].Expires = DateTime.Now.AddMinutes(1);

would place cookie on HDD regardless of "Expires" property (even if I don't
set it)

In MSDN I found object Cookie with property Discard. This is what I need,
but the one I use is HttpCookie.

How do I set this in-memory cookie???

Thanks!
 

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

Similar Threads

cookie trouble 3
Cookie problem 8
Simple question about cookies 1
Can't Write Cookie IE 5
Can't Update of Cookie 2
Test cookie 1
Page refresh question 2
cookie troubles 1

Top