Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    May 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Convert Object to a String

    I want to store a Request.Form/QueryString value in a Session object...

    Code:
     Session(qnum+'OS') = Request.Form("sOption");
    But it shows me this error:

    Session object error 'ASP 0168 : 80004005'

    Disallowed object use

    /papers/maths/CheckAnswer.asp, line 8

    An intrinsic object cannot be stored within the Session object.

    --
    I've tried the .Item at the end of Request.Form/QueryString, but it is not retrieving the value of the field.

    Never mind the i

  • #2
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    It's the Session(qnum+'OS') that's causing the problem.

    You need to make it

    Session("OS") = Request.form("sOption") + qnum

    OR

    Session("OS") = qnum + Request.form("sOption")

    ASP is throwing the error because you cannot create session names dynamically.
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #3
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    Am I being daft or do you not surely also need to change the "+" addition operator for a "&" concatenation operator? Or does VBScript work with both? TBH I've never tried....

  • #4
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Well, it looks as though (by code) that s/he is trying to add qnum and Request.form("sOption"), which is why s/he is using the '+' operand.

    But you are correct -- concatenation in ASP is '&', not '+'. You cannot use '+' in ASP except for mathematical addition.
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #5
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,062
    Thanks
    4
    Thanked 8 Times in 8 Posts
    Actually in VB you can concatenate with BOTH the + and & operands. However, It is bad practice to use + as a concatenation operator because it makes the code harder to read for the next person.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •