Empty parameters in a asp .net (vb) page query string

Discussion in 'ASP .Net' started by Paul M., Aug 31, 2003.

  1. Paul M.

    Paul M. Guest

    Hi,
    I am trying to populate 3 paramters in an asp .net (vb) page redirect,
    the first one is ok ok and gets populated by the other two get inserted into
    the url for the redirect as empty strings! Anyone got any clues?? The code
    is below and I have checked that the variables beginning with "g_str" are
    all populated before the code is called. I think its something to do with
    the "&" in the "&Title" and "&Version", do I need to do something to
    those???

    Cheers
    Paul

    Dim strVal_1 as string
    Dim strVal_2 as string
    Dim strVal_3 as string

    strVal_1= "?SQL=" & g_strSQL
    strVal_2= "&Title=" + g_strTitle
    strVal_3= "&Version=" + g_strVersion

    Response.Redirect("http://localhost/misc/frmEntry.aspx?Error=" & strVal_1 &
    strVal_2 & strVal_3)
     
    Paul M., Aug 31, 2003
    #1
    1. Advertising

  2. Paul M.

    William Ryan Guest

    Paul...I'm not sure but when you step through it in the debugger, I'm
    assuming all the assignement are done correctl ( ie strVal_1, strVal_2 and
    strVal3)

    Try this...

    Dim sb as New System.Text.Stringbuilder
    sb.Append("http://localhost/misc/frmEntry.aspx?Error=")
    sb.Append("?SQL=" & strSQL)
    sb.Append("&Title=" & g_strTitle)
    sb.Append("&Version=" & g_strVersion)
    'Put breakpoint here to make sure redirect is what you want in it's
    entirety - in the command window ?sb.ToSTring

    Response.Redirect(sb.ToSTring)

    It looks like the + might be the cause of improper string concatenation. In
    either case, even if you don't use a stringbuilder, just add on all
    concatenations with the line continue character _ b/c as it stands now,
    you're creating at a minimum 3 string objects when one would do. (This
    isn't the problem you are referring to, but it's just a suggestion for
    efficiency's sake.)

    Let me know if the full query string is getting populated correctly and if
    so, we'll try to narrow it down from there.

    Good Luck,

    Bill

    "Paul M." <> wrote in message
    news:bitd7f$bq3$...
    > Hi,
    > I am trying to populate 3 paramters in an asp .net (vb) page redirect,
    > the first one is ok ok and gets populated by the other two get inserted

    into
    > the url for the redirect as empty strings! Anyone got any clues?? The code
    > is below and I have checked that the variables beginning with "g_str" are
    > all populated before the code is called. I think its something to do with
    > the "&" in the "&Title" and "&Version", do I need to do something to
    > those???
    >
    > Cheers
    > Paul
    >
    > Dim strVal_1 as string
    > Dim strVal_2 as string
    > Dim strVal_3 as string
    >
    > strVal_1= "?SQL=" & g_strSQL
    > strVal_2= "&Title=" + g_strTitle
    > strVal_3= "&Version=" + g_strVersion
    >
    > Response.Redirect("http://localhost/misc/frmEntry.aspx?Error=" & strVal_1

    &
    > strVal_2 & strVal_3)
    >
    >
     
    William Ryan, Aug 31, 2003
    #2
    1. Advertising

  3. Paul M.

    Dave Bush Guest

    You probably need to URLEncode the variables.

    You can look that up in the help system.

    "William Ryan" <> wrote in message
    news:uUpjj3$...
    > Paul...I'm not sure but when you step through it in the debugger, I'm
    > assuming all the assignement are done correctl ( ie strVal_1, strVal_2 and
    > strVal3)
    >
    > Try this...
    >
    > Dim sb as New System.Text.Stringbuilder
    > sb.Append("http://localhost/misc/frmEntry.aspx?Error=")
    > sb.Append("?SQL=" & strSQL)
    > sb.Append("&Title=" & g_strTitle)
    > sb.Append("&Version=" & g_strVersion)
    > 'Put breakpoint here to make sure redirect is what you want in it's
    > entirety - in the command window ?sb.ToSTring
    >
    > Response.Redirect(sb.ToSTring)
    >
    > It looks like the + might be the cause of improper string concatenation.

    In
    > either case, even if you don't use a stringbuilder, just add on all
    > concatenations with the line continue character _ b/c as it stands now,
    > you're creating at a minimum 3 string objects when one would do. (This
    > isn't the problem you are referring to, but it's just a suggestion for
    > efficiency's sake.)
    >
    > Let me know if the full query string is getting populated correctly and if
    > so, we'll try to narrow it down from there.
    >
    > Good Luck,
    >
    > Bill
    >
    > "Paul M." <> wrote in message
    > news:bitd7f$bq3$...
    > > Hi,
    > > I am trying to populate 3 paramters in an asp .net (vb) page

    redirect,
    > > the first one is ok ok and gets populated by the other two get inserted

    > into
    > > the url for the redirect as empty strings! Anyone got any clues?? The

    code
    > > is below and I have checked that the variables beginning with "g_str"

    are
    > > all populated before the code is called. I think its something to do

    with
    > > the "&" in the "&Title" and "&Version", do I need to do something to
    > > those???
    > >
    > > Cheers
    > > Paul
    > >
    > > Dim strVal_1 as string
    > > Dim strVal_2 as string
    > > Dim strVal_3 as string
    > >
    > > strVal_1= "?SQL=" & g_strSQL
    > > strVal_2= "&Title=" + g_strTitle
    > > strVal_3= "&Version=" + g_strVersion
    > >
    > > Response.Redirect("http://localhost/misc/frmEntry.aspx?Error=" &

    strVal_1
    > &
    > > strVal_2 & strVal_3)
    > >
    > >

    >
    >
     
    Dave Bush, Sep 6, 2003
    #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. Austin
    Replies:
    8
    Views:
    963
    VisionSet
    Nov 18, 2003
  2. ButlerDJIAM
    Replies:
    0
    Views:
    581
    ButlerDJIAM
    Nov 9, 2006
  3. Tzury Bar Yochay
    Replies:
    1
    Views:
    421
    Gabriel Genellina
    Mar 24, 2008
  4. Savvoulidis Iordanis

    Empty gridview cells and checking for empty string

    Savvoulidis Iordanis, Sep 5, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    560
    Savvoulidis Iordanis
    Sep 5, 2008
  5. nick
    Replies:
    1
    Views:
    518
    David Mark
    Feb 13, 2011
Loading...

Share This Page