file not rendered because too many cookies

A

André

Hi,

Not sure it's a asp.net problem, but i discovered it with asp.net, so ...

I need to pass data from page to another, so i use cookies for that. My
problem is that when a certain amount of cookies are created, the browser
doesn't render the page anymore. The threshold i found (with trial and
error) is this: 48 times 5 cookies.
If i put 49 instead of 48, the page is not rendered (error= "the page cannot
be rendered"), otherwise, below 49, it works.

Any explanation for that, and possibly a solution?
Thanks
André.

dim i as integer
Dim cokval As new HttpCookie("cok")
Dim cok1 As New HttpCookie("cok1")
Dim cok2 As New HttpCookie("cok2")
Dim cok3 As New HttpCookie("cok3")
Dim cok4 As New HttpCookie("cok4")
Dim cok5 As New HttpCookie("cok5")
for i=1 to 48
cok1.Value = 10
Response.Cookies.Add(cok1)
cok2.Value = 8
Response.Cookies.Add(cok2)
cok3.Value = 12
Response.Cookies.Add(cok3)
cok4.Value = 5
Response.Cookies.Add(cok4)
cok5.Value = 6
Response.Cookies.Add(cok5)
next
 
R

Rad [Visual C# MVP]

Hey Andre,

You don't need to use cookies to pass data from one page to another.
For one thing the performance will suffer because cookies involve IO
operations (writing it and then reading it again)

Try and use the QueryString instead:

From page 1

Response.Redirect(string.Format("Page2.aspx?Item0={0}&Item1={1},Item2={2}",10,8,12));

From Page 2

string Item0 = Request.QueryString["Item0"];
string Item1 = Request.QueryString["Item1"];
string Item2 = Request.QueryString["Item2"];
 
A

André

Thanks, i will try/
But did you heard about that cookie limitation?

Rad said:
Hey Andre,

You don't need to use cookies to pass data from one page to another.
For one thing the performance will suffer because cookies involve IO
operations (writing it and then reading it again)

Try and use the QueryString instead:

From page 1

Response.Redirect(string.Format("Page2.aspx?Item0={0}&Item1={1},Item2={2}",10,8,12));

From Page 2

string Item0 = Request.QueryString["Item0"];
string Item1 = Request.QueryString["Item1"];
string Item2 = Request.QueryString["Item2"];

Hi,

Not sure it's a asp.net problem, but i discovered it with asp.net, so ...

I need to pass data from page to another, so i use cookies for that. My
problem is that when a certain amount of cookies are created, the browser
doesn't render the page anymore. The threshold i found (with trial and
error) is this: 48 times 5 cookies.
If i put 49 instead of 48, the page is not rendered (error= "the page
cannot
be rendered"), otherwise, below 49, it works.

Any explanation for that, and possibly a solution?
Thanks
André.

dim i as integer
Dim cokval As new HttpCookie("cok")
Dim cok1 As New HttpCookie("cok1")
Dim cok2 As New HttpCookie("cok2")
Dim cok3 As New HttpCookie("cok3")
Dim cok4 As New HttpCookie("cok4")
Dim cok5 As New HttpCookie("cok5")
for i=1 to 48
cok1.Value = 10
Response.Cookies.Add(cok1)
cok2.Value = 8
Response.Cookies.Add(cok2)
cok3.Value = 12
Response.Cookies.Add(cok3)
cok4.Value = 5
Response.Cookies.Add(cok4)
cok5.Value = 6
Response.Cookies.Add(cok5)
next
 
R

Rad [Visual C# MVP]

Yes, there are limits... Think about it. Should a server be allowed to
set a 1GB cookie on your hard disk?

Read this link for some details:
http://blogs.msdn.com/wndp/archive/2006/08/28/a_tale_of_20_cookies.aspx

Thanks, i will try/
But did you heard about that cookie limitation?

Rad said:
Hey Andre,

You don't need to use cookies to pass data from one page to another.
For one thing the performance will suffer because cookies involve IO
operations (writing it and then reading it again)

Try and use the QueryString instead:

From page 1

Response.Redirect(string.Format("Page2.aspx?Item0={0}&Item1={1},Item2={2}",10,8,12));

From Page 2

string Item0 = Request.QueryString["Item0"];
string Item1 = Request.QueryString["Item1"];
string Item2 = Request.QueryString["Item2"];

Hi,

Not sure it's a asp.net problem, but i discovered it with asp.net, so ...

I need to pass data from page to another, so i use cookies for that. My
problem is that when a certain amount of cookies are created, the browser
doesn't render the page anymore. The threshold i found (with trial and
error) is this: 48 times 5 cookies.
If i put 49 instead of 48, the page is not rendered (error= "the page
cannot
be rendered"), otherwise, below 49, it works.

Any explanation for that, and possibly a solution?
Thanks
André.

dim i as integer
Dim cokval As new HttpCookie("cok")
Dim cok1 As New HttpCookie("cok1")
Dim cok2 As New HttpCookie("cok2")
Dim cok3 As New HttpCookie("cok3")
Dim cok4 As New HttpCookie("cok4")
Dim cok5 As New HttpCookie("cok5")
for i=1 to 48
cok1.Value = 10
Response.Cookies.Add(cok1)
cok2.Value = 8
Response.Cookies.Add(cok2)
cok3.Value = 12
Response.Cookies.Add(cok3)
cok4.Value = 5
Response.Cookies.Add(cok4)
cok5.Value = 6
Response.Cookies.Add(cok5)
next
 
W

wfairl

It would definitely be limited by the allowed header size for a
request. Look into MaxRequestBytes for IIS. There's also an upper limit
to querystring size, is there any reason you're not using session
state?


André said:
Thanks, i will try/
But did you heard about that cookie limitation?

Rad said:
Hey Andre,

You don't need to use cookies to pass data from one page to another.
For one thing the performance will suffer because cookies involve IO
operations (writing it and then reading it again)

Try and use the QueryString instead:

From page 1

Response.Redirect(string.Format("Page2.aspx?Item0={0}&Item1={1},Item2={2}",10,8,12));

From Page 2

string Item0 = Request.QueryString["Item0"];
string Item1 = Request.QueryString["Item1"];
string Item2 = Request.QueryString["Item2"];

Hi,

Not sure it's a asp.net problem, but i discovered it with asp.net, so ....

I need to pass data from page to another, so i use cookies for that. My
problem is that when a certain amount of cookies are created, the browser
doesn't render the page anymore. The threshold i found (with trial and
error) is this: 48 times 5 cookies.
If i put 49 instead of 48, the page is not rendered (error= "the page
cannot
be rendered"), otherwise, below 49, it works.

Any explanation for that, and possibly a solution?
Thanks
André.

dim i as integer
Dim cokval As new HttpCookie("cok")
Dim cok1 As New HttpCookie("cok1")
Dim cok2 As New HttpCookie("cok2")
Dim cok3 As New HttpCookie("cok3")
Dim cok4 As New HttpCookie("cok4")
Dim cok5 As New HttpCookie("cok5")
for i=1 to 48
cok1.Value = 10
Response.Cookies.Add(cok1)
cok2.Value = 8
Response.Cookies.Add(cok2)
cok3.Value = 12
Response.Cookies.Add(cok3)
cok4.Value = 5
Response.Cookies.Add(cok4)
cok5.Value = 6
Response.Cookies.Add(cok5)
next
 

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


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top