سؤال

I've got an problem with Cookie. That's the code:

NameValueCollection ncook = new NameValueCollection();
ncook = HttpContext.Current.Request.Cookies["history"].Values - in that line

What is in my cookie:

item_0=nonpacket-program.aspx?id=360ANDcourse=1044ANDcenter=238ANDfeeding=ANDinhabitation=

That's what I expect to recieve from the line showen before. And here it is what I actualy recieve:

item_0=nonpacket-program.aspx%3fid%3d360ANDcourse%3d1044ANDcenter%3d238ANDfeeding%3dANDinhabitation%3d&item_0=nonpacket-program.aspx%3fid%3d360ANDcourse%3d1044ANDcenter%3d238ANDfeeding%3dANDinhabitation%3d

How you can see the value is doubled. And that's the problem.... What am I doing wrong?

هل كانت مفيدة؟

المحلول

First thought is that you are assigning ncook the value of an existing cookie, and then a postback happens, and the "history" cookie now has two entries in its values. the "history" cookie is a history, so for each postpack, I'm betting the history cookie grows, and thus, ncook will grow as well.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top