Passing Session In QueryString!

Discussion in 'ASP General' started by Arpan, Sep 15, 2005.

  1. Arpan

    Arpan Guest

    In my ASP application, a Session variable takes the following form

    <%
    Dim strRec,strCol
    strRec=Request.QueryString("records")
    strCol=Request.QueryString("columns")

    Session("RecCol")=strCol & "='" & strRec & "'"
    %>

    The page has a drop-down list. When a user selects an option from the
    drop-down, the page gets submitted to itself automatically. This is how
    I have done it:

    <select name="rc" onChange="gotoURL(this.form.rc)">
    <option value="Try.asp?records=<%= strRec %>&columns=<%= strCol
    %>&sess=<%= Session("RecCol") %>Option1</option>
    ......
    ......
    </select>

    & this is the JavaScript code that gets executed when an option is
    selected from the drop-down:

    <script language="JavaScript">
    function gotoURL(objURL){
    window.location.href=objURL.options[objURL.selectedIndex].value
    }
    </script>

    Now when an option is selected from the drop-down, the URL becomes

    Try.asp?records=rec2&column=col2&sess==''

    instead of

    Try.asp?records=rec2&column=col2&sess=col1='rec1'

    I thought that maybe the equal to sign '=' & the single quotes may be
    causing the problem & hence replaced these 2 characters while creating
    the Session variable in this way:

    Session("RecCol")=strCol & "#}" & strRec & "}"

    & later replaced "#" with "=" & "}" with single quotes "'" but that
    still didn't solve the problem. The URL now becomes

    Try.asp?records=rec2&column=col2&sess=#}}

    Any suggestions?

    Thanks,

    Arpan
     
    Arpan, Sep 15, 2005
    #1
    1. Advertising

  2. Arpan

    Steven Burn Guest

    Have you done a response.write on Session("RecCol") to see what it actually
    contains?

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    "Arpan" <> wrote in message
    news:...
    > In my ASP application, a Session variable takes the following form
    >
    > <%
    > Dim strRec,strCol
    > strRec=Request.QueryString("records")
    > strCol=Request.QueryString("columns")
    >
    > Session("RecCol")=strCol & "='" & strRec & "'"
    > %>
    >
    > The page has a drop-down list. When a user selects an option from the
    > drop-down, the page gets submitted to itself automatically. This is how
    > I have done it:
    >
    > <select name="rc" onChange="gotoURL(this.form.rc)">
    > <option value="Try.asp?records=<%= strRec %>&columns=<%= strCol
    > %>&sess=<%= Session("RecCol") %>Option1</option>
    > .....
    > .....
    > </select>
    >
    > & this is the JavaScript code that gets executed when an option is
    > selected from the drop-down:
    >
    > <script language="JavaScript">
    > function gotoURL(objURL){
    > window.location.href=objURL.options[objURL.selectedIndex].value
    > }
    > </script>
    >
    > Now when an option is selected from the drop-down, the URL becomes
    >
    > Try.asp?records=rec2&column=col2&sess==''
    >
    > instead of
    >
    > Try.asp?records=rec2&column=col2&sess=col1='rec1'
    >
    > I thought that maybe the equal to sign '=' & the single quotes may be
    > causing the problem & hence replaced these 2 characters while creating
    > the Session variable in this way:
    >
    > Session("RecCol")=strCol & "#}" & strRec & "}"
    >
    > & later replaced "#" with "=" & "}" with single quotes "'" but that
    > still didn't solve the problem. The URL now becomes
    >
    > Try.asp?records=rec2&column=col2&sess=#}}
    >
    > Any suggestions?
    >
    > Thanks,
    >
    > Arpan
    >
     
    Steven Burn, Sep 16, 2005
    #2
    1. Advertising

  3. Arpan

    Guest

    Two things that I can think of:
    - Cookies are disabled in the browser. Session variables are stored
    as cookies, if cookies are disabled, they won't hold information
    - global.asa is empty

    Arpan wrote:
    > In my ASP application, a Session variable takes the following form
    >
    > <%
    > Dim strRec,strCol
    > strRec=Request.QueryString("records")
    > strCol=Request.QueryString("columns")
    >
    > Session("RecCol")=strCol & "='" & strRec & "'"
    > %>
    >
    > The page has a drop-down list. When a user selects an option from the
    > drop-down, the page gets submitted to itself automatically. This is how
    > I have done it:
    >
    > <select name="rc" onChange="gotoURL(this.form.rc)">
    > <option value="Try.asp?records=<%= strRec %>&columns=<%= strCol
    > %>&sess=<%= Session("RecCol") %>Option1</option>
    > .....
    > .....
    > </select>
    >
    > & this is the JavaScript code that gets executed when an option is
    > selected from the drop-down:
    >
    > <script language="JavaScript">
    > function gotoURL(objURL){
    > window.location.href=objURL.options[objURL.selectedIndex].value
    > }
    > </script>
    >
    > Now when an option is selected from the drop-down, the URL becomes
    >
    > Try.asp?records=rec2&column=col2&sess==''
    >
    > instead of
    >
    > Try.asp?records=rec2&column=col2&sess=col1='rec1'
    >
    > I thought that maybe the equal to sign '=' & the single quotes may be
    > causing the problem & hence replaced these 2 characters while creating
    > the Session variable in this way:
    >
    > Session("RecCol")=strCol & "#}" & strRec & "}"
    >
    > & later replaced "#" with "=" & "}" with single quotes "'" but that
    > still didn't solve the problem. The URL now becomes
    >
    > Try.asp?records=rec2&column=col2&sess=#}}
    >
    > Any suggestions?
    >
    > Thanks,
    >
    > Arpan
     
    , Sep 16, 2005
    #3
    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. Mehdi
    Replies:
    6
    Views:
    36,123
    sloan
    Apr 6, 2006
  2. news-server.maine.rr.com

    Passing querystring parameters to Frameset -- How?

    news-server.maine.rr.com, Feb 6, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    760
    Frank Milverckowitz
    Feb 6, 2007
  3. =?Utf-8?B?cm9kY2hhcg==?=

    passing a querystring

    =?Utf-8?B?cm9kY2hhcg==?=, Oct 26, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    441
    Maximiliano
    Oct 27, 2007
  4. Bobby Edward
    Replies:
    3
    Views:
    1,297
    Bobby Edward
    Jan 23, 2009
  5. Adeel Ahmad
    Replies:
    1
    Views:
    523
    Anthony Jones
    Mar 7, 2006
Loading...

Share This Page