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

Discussion in '.NET' started by gaurav1234, Jul 7, 2010.

  1. gaurav1234

    gaurav1234

    Joined:
    Jul 7, 2010
    Messages:
    1
    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
     
    gaurav1234, Jul 7, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Luan
    Replies:
    2
    Views:
    152
    Wilson Bilkovich
    Nov 29, 2006
  2. newyork799-miscperl@yahoo.com

    why I gave up -w and "use strict"

    newyork799-miscperl@yahoo.com, Aug 26, 2005, in forum: Perl Misc
    Replies:
    5
    Views:
    105
    axel@white-eagle.invalid.uk
    Aug 28, 2005
  3. newyork799-miscperl@yahoo.com

    and I gave up the shebang line too

    newyork799-miscperl@yahoo.com, Aug 26, 2005, in forum: Perl Misc
    Replies:
    10
    Views:
    171
    J├╝rgen Exner
    Aug 28, 2005
  4. PerlFAQ Server
    Replies:
    19
    Views:
    229
    John Bokma
    Apr 28, 2011
  5. Dave
    Replies:
    5
    Views:
    705
    John Bokma
    Apr 26, 2011
Loading...

Share This Page