|
-
Jan 17th, 2006, 09:40 AM
#1
Thread Starter
Frenzied Member
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.
-
Jan 18th, 2006, 04:40 AM
#2
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.
-
Jan 18th, 2006, 04:45 AM
#3
Thread Starter
Frenzied Member
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?
-
Jan 19th, 2006, 09:19 PM
#4
Thread Starter
Frenzied Member
Re: hopefully simple querystring headache
-
Jan 20th, 2006, 05:32 AM
#5
Re: hopefully simple querystring headache
 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';
}
-
Jan 20th, 2006, 08:00 AM
#6
Thread Starter
Frenzied Member
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.
-
Jan 21st, 2006, 06:03 AM
#7
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>
-
Jan 21st, 2006, 07:06 AM
#8
Thread Starter
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|