Ampersand problem

Discussion in 'ASP .Net' started by Rodusa, Feb 8, 2005.

  1. Rodusa

    Rodusa Guest

    I am having problems to use Response.Redirect(URL) with this URL below.
    The problem happens only with 1319&

    string URL =
    "default.aspx?contactid=C6UJ9A000R9D&uidcustomquote=1319&quoteuserid=ADMIN&slxuserid=ADMIN";


    I try to response.write(URL) and I get this as a result
    default.aspx?contactid=C6UJ9A000R9D&uidcustomquote=1319"euserid=ADMIN&slxuserid=ADMIN


    I obtained the querystring of this URL with
    Request.ServerVariables("QUERY_STRING") and I tried to encode it with
    Server.URLEncode, however I still get the same URL above. It is really
    weird because the other parameters seem to be ok.

    Please help

    Rod
     
    Rodusa, Feb 8, 2005
    #1
    1. Advertisements

  2. The problem is that "&quot" is being interpreted as " .

    Try
    string URL =
    "default.aspx?contactid=C6UJ9A000R9D&uidcustomquote=1319&userid=ADMIN&slxuserid=ADMIN";

    You may have to change your parameter's name from
    quoteuserid to userid, or any other name *but* quoteuserid.
     
    Juan T. Llibre, Feb 8, 2005
    #2
    1. Advertisements

  3. Steve C. Orr [MVP, MCSD], Feb 8, 2005
    #3
  4. Rodusa

    Rodusa Guest

    Steve,

    I did try encoding with Server.URLEncode. However, I can only encode
    the parameters individually because when I encode the whole QueryString
    via Request.ServerVariables["QUERY_STRING"] it messes up the (=)
    making the URL invalid. The easier way is what Juan suggested: to
    change the param name uidcustomquote to something else.

    I appreciate your suggestions


    Rod
     
    Rodusa, Feb 9, 2005
    #4
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.