Results 1 to 6 of 6

Thread: querystring problem

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    querystring problem

    in my ASP.NET app, I have a problem where if a user clicks on an email to a link to my page, along with it are some querystring values.

    the querystring values are incorrect, these values are replaced:

    =
    &

    which makes the querystring invalid.

    how can I replace these values that have been changed to the original value? the = and & does not appear in the querystring but are replaced with things like %3d and %26

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: querystring problem

    The links in the email have been generated incorrectly. That is where the problem is arising. What do the email links look like?

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: querystring problem

    the email links are in a correct format as I have checked.

    Code:
    string link = "<a href=\"http://somesite.com/somepage.aspx?something=" + theLink.Trim() + "&another=" + another.Trim() + "\">click here </a>";
    some email providers for some reason do this as I have discovered.

    I have found that if I use Server.Decode(url) this formats the url back into the correct format but since there will be a few querystrings, how would I then be able to retrieve these querystrings from the Server.Decode(url) ?

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: querystring problem

    I see, that's odd that an email provider would do that. It would break just about every link wouldn't it?

    Anyways, you'll get the string once you do the Server.Decode(), so to proceed from here, get the portion of the string after the ?, then split it using the & as a delimiter.

    In the array then, you'll have your querystring values.

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: querystring problem

    thanks, that is true I could do that but I also thought maybe I could do a Server.UrlDecode(url) and append "&s=1" and redirect it back to the page with this new link.

    I would then check to see if it can read the "s" querystring, if so, then continue otherwise do whatever

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: querystring problem

    There are 99 ways to skin a cat.

Posting Permissions

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



Click Here to Expand Forum to Full Width