set a cookie clientside on Textbox onChange

  • Thread starter Thread starter Nalaka
  • Start date Start date
N

Nalaka

Hi,
I have a textbox, I need to set a cookie to the value of the textbox... when
textbox.Text changes.

How do I do this using clientSide script (javascript) only.

I do not want to post back to the server and then set the cookie using
server script.

Any help is very appretiated (I did search the internet)...
Nalaka
 
Hi Nalaka,

I think the article Gregory provided is quite good and useful.

BTW, client-side inserted cookie may escape some special characters. When
reading them in server-side code, you may take care on this, you can use
the UrlDecode method to decode them if the cookie(added at client-side) is
escaped:

foreach (string key in Request.Cookies.Keys)
{
Response.Write("<br/>" + key + ": " +
Server.UrlDecode(Request.Cookies[key].Value));
}

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top