Results 1 to 8 of 8

Thread: hopefully simple querystring headache

  1. #1

    Thread Starter
    Frenzied Member Phill64's Avatar
    Join Date
    Jul 2005
    Location
    Queensland, Australia
    Posts
    1,201

    Cool hopefully simple querystring headache

    Ok, i have a custom 404 page, this works fine.. until you click something on the form, where the url gets the 404 page info put into the querystring

    like this:
    index.aspx?404;http://localhost/business/ID--1.htm

    I don't require to keep that querystring, and don't want it hanging around, but i can't figure out how to remove it.

    thank you.

  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: hopefully simple querystring headache

    Where have you handled your 404s from? Do you have a global error handling routine in your global.asax? You can Perform any uncaught error hangling in there, then redirect to a custom 404 page. Is that helpful? Or do you positively need it done this way?

    If it's the second option, then you can have a body onload event in your ID--1.htm page which reloads that page without querystring parameters.

  3. #3

    Thread Starter
    Frenzied Member Phill64's Avatar
    Join Date
    Jul 2005
    Location
    Queensland, Australia
    Posts
    1,201

    Re: hopefully simple querystring headache

    Ok,

    it's like this, i have IIS set to redirect 404 errors to my index page, the index page reads what url requested it, if its not correct (must be a 404) and it uses the filename as a command. After this when something on the age is clicked the URL should go back to index.aspx, which it does but with the querystring, i would just redirect to the page but i'd lose the form fields and events.

    Any ideas what i can do to remove the querystring with code, rather than redirect?

  4. #4

    Thread Starter
    Frenzied Member Phill64's Avatar
    Join Date
    Jul 2005
    Location
    Queensland, Australia
    Posts
    1,201

    Re: hopefully simple querystring headache

    bump.. anybody?

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

    Re: hopefully simple querystring headache

    Quote Originally Posted by Phill64
    Ok,

    it's like this, i have IIS set to redirect 404 errors to my index page, the index page reads what url requested it, if its not correct (must be a 404) and it uses the filename as a command. After this when something on the age is clicked the URL should go back to index.aspx, which it does but with the querystring, i would just redirect to the page but i'd lose the form fields and events.

    Any ideas what i can do to remove the querystring with code, rather than redirect?
    Sorry, your sentence is too jumbled.

    Can you explain again? And if you are confirming what I asked, then do this in the body's onload event, call a function that does this

    if(window.location.search.length>1)
    {
    document.location.href='my404pagename.aspx';
    }

  6. #6

    Thread Starter
    Frenzied Member Phill64's Avatar
    Join Date
    Jul 2005
    Location
    Queensland, Australia
    Posts
    1,201

    Re: hopefully simple querystring headache

    sorry about that,
    but you did understand it correctly, i just want to remove the querystring, but i need to keep the forms fields.

    what i can't figure out, is how to change the url like your example, .request is readonly so i cant just remvoe all querystrings. There surely must be a property somewhere, but i have been searching and searching and just cannot find it.

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

    Re: hopefully simple querystring headache

    I hope you didn't try the above code in codebehind. It's javascript.

    HTML Code:
    <html>
    <head>
    <script language="JavaScript">
    function myFunction()
    {
    if(window.location.search.length>1)
    {
    document.location.href='my404pagename.aspx';
    }
    }
    </script>
    
    <body onLoad="myFunction();">
    ...........
    </body>
    </html>

  8. #8

    Thread Starter
    Frenzied Member Phill64's Avatar
    Join Date
    Jul 2005
    Location
    Queensland, Australia
    Posts
    1,201

    Re: hopefully simple querystring headache

    oh, right.. i nthat case that's just the same as a redirection.

    I guess the only way ill be able to do it is by using context and server.transfer

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