472,126 Members | 1,436 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,126 software developers and data experts.

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 4412
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

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.