469,319 Members | 2,429 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,319 developers. It's quick & easy.

ASP Different Results In Firefox And IE !

Hi,

I have following code, picking an ID and saving it to Cookies.

<%
ItemID = Request("prod")
Response.Cookies("THREES")(ItemID) = Request("prod")
Set rdset=objConn.Execute("SELECT ID, Name, Large, Description
FROM shop_products WHERE ID=" & ItemID)
%>

In IE it works fine as it should, adding item id to Cookies

In Firefox it gives me the following error:
Cookies object, ASP 0102 (0x80004005)
The function expects a string as input.
/shop/addcart.asp, line 27

Any information on that. Any idea what is going wrong.

Best Wishes
Lovely

Jul 31 '06 #1
4 4291
As I was using form to send "prod" to next page, using hidden element
in form on previous page.

I update the code as :

<%
ItemID = Request.form("prod")
Response.Cookies("THREES")(ItemID) = Request.form("prod")
Set rdset=objConn.Execute("SELECT ID, Name, Large, Description
FROM shop_products WHERE ID=" & ItemID)
%>

It work in IE, stil doesnt work in FireFox.

Any ideas.

Best Wishes
Lovely

Jul 31 '06 #2
Changed it to:

<%
ItemID = Cstr(Request.form("prod"))
Response.Cookies("THREES")(ItemID) = Request.form("prod")
Set rdset=objConn.Execute("SELECT ID, Name, Large, Description
FROM shop_products WHERE ID=" & Request.form("prod"))
%>

Still in IE its working as it should be, in FireFox, it is not giving
error:

Cookies object, ASP 0183 (0x80004005)
A cookie with an empty key cannot be stored.
/shop/addcart.asp, line 2

Any ideas.

Best Wishes
Lovely

Jul 31 '06 #3
You seem to be storing the cookie with the same value for the cookies key as
well as its value as ItemID = Cstr(Request.form("prod"))

is this what you wanted to do?

either way,

response.write ItemID

to see if in fact it does hold a string key

<lo******************@yahoo.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
Changed it to:

<%
ItemID = Cstr(Request.form("prod"))
Response.Cookies("THREES")(ItemID) = Request.form("prod")
Set rdset=objConn.Execute("SELECT ID, Name, Large, Description
FROM shop_products WHERE ID=" & Request.form("prod"))
%>

Still in IE its working as it should be, in FireFox, it is not giving
error:

Cookies object, ASP 0183 (0x80004005)
A cookie with an empty key cannot be stored.
/shop/addcart.asp, line 2

Any ideas.

Best Wishes
Lovely

Jul 31 '06 #4

Slim wrote:
You seem to be storing the cookie with the same value for the cookies key as
well as its value as ItemID = Cstr(Request.form("prod"))

is this what you wanted to do?

either way,

response.write ItemID

to see if in fact it does hold a string key
Ah, good old ASP and its variant data types.

I've just been playing around and I can reproduce the error thus:
Works : Response.Cookies("monkey")("1") = "badger"
Fails: Response.Cookies("monkey")(1) = "badger"

In which case it's because -- as the error implies -- your parameter
ItemID needs to be explicitly cast as a string, like this:

Response.Cookies("THREES")(CStr(ItemID)) = Request("prod")

CStr forces the variable to have an internal variable type of 'String',
which you can test using the TypeName() function.

http://www.w3schools.com/vbscript/func_typename.asp

Hope this helps.

Jul 31 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by robert.waters | last post: by
17 posts views Thread by pasdecrap | last post: by
3 posts views Thread by Jukka K. Korpela | last post: by
53 posts views Thread by Jonas Smithson | last post: by
16 posts views Thread by LayneMitch | last post: by
1 post views Thread by Chris | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by mdpf | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.