Remove a variable from QUERY_STRING?

Discussion in 'C#' started by digitalunix, May 12, 2009.

  1. #1
    Anyone can help with a problem? I have a page named e.g: search.asp?id=firms&location=Texas&dated=today. And i write "Location: Texas" from the "Location: <%=Request("location")%>" and put a button next to it named, "Unfilter" and this button or so to say an a href link is to remove the "location" variable from the Query_String. Or the same thing should work for "dated" variable as well. This is something like filtering the criteria of the searches. I hope i explained it clearly...

    Can anyone help me to remove just a specific variable from a Query_String and leave the rest of the query as it is?
     
    digitalunix, May 12, 2009 IP
  2. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #2
    So if they click unfilter it should resend the querystring with the omission of whatever they have 'unfiltered' ???
     
    camjohnson95, May 12, 2009 IP
  3. digitalunix

    digitalunix Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Exactly. This is what i need.
     
    digitalunix, May 13, 2009 IP
  4. Corwin

    Corwin Well-Known Member

    Messages:
    2,438
    Likes Received:
    107
    Best Answers:
    0
    Trophy Points:
    195
    #4
    <%
    Response.Redirect "search.asp?id=firms&dated=today"
    %>
     
    Corwin, May 13, 2009 IP
  5. Corwin

    Corwin Well-Known Member

    Messages:
    2,438
    Likes Received:
    107
    Best Answers:
    0
    Trophy Points:
    195
    #5
    Oops. Sorry, that won't do what you want. To show the new URL in the address bar with Response.Redirect, you need to redirect to the FULL path:

    <%
    Response.Redirect "http://www.yourdomain.com/search.asp?id=firms&dated=today"
    %>
     
    Corwin, May 14, 2009 IP