i used the following code in .aspx file but gave error

Joined
Jul 7, 2010
Messages
1
Reaction score
0
hi i hv 2 doubts

(1) System.InvalidCastException: Operator '&' is not defined for string "fname=" and type 'HttpCookie'.Plz explain why so and how to correct it explicitly

<html>
<body>

<%
dim x,y
for each x in Request.Cookies
response.write("<p>")
if Request.Cookies(x).HasKeys then
for each y in Request.Cookies(x)
response.write(x & ":" & y & "=" & Request.Cookies(x)(y))
response.write("<br />")
next
else
Response.Write(x & "=" & Request.Cookies(x) & "<br />")
end if
response.write ("</p>")
next
%>

</body>
</html>
(2)the following statement gave an error in .aspx file.
response.cookies("NumVisits")=1
I found that it is corrected if value is used. why is this difference between asp and asp.net
response.cookies("NumVisits").value=1
 

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

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top