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. :ehh:
thank you.
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.
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?
Re: hopefully simple querystring headache
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. :sick:
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';
}
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.
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>
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