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