custom 404 page works in IE but not firefox

custom 404 page works in IE but not firefox

am 03.04.2008 01:24:00 von betty

Hi all,

A couple of months ago. I posted a thread and asked for help for redirect
all our site *.htm pages to *.asp pages because of our site upgrade almost
all *.htm to *.asp.
So some community members suggested use custom error page and redirect the
page to the same file but different ext. *.asp and it works fine in IE. But
when we tested in firefox today. it is not working. I wonder why? It is
because firefox return different format qstr? can you give me some clue. How
can I display the qstr in broswer in order to investigate it?
here is the code:

<% ' vbs
qstr = Request.ServerVariables("QUERY_STRING")

If instr(lcase(qstr),".htm")>0 then
on error resume next
x = replace(qstr, "404;http://www.mydomain.com:80","")
'404;http://www.mydomain.com:80
x = replace(x,".htm",".asp")

'server.transfer x
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", x
'Response.Redirect x

on error resume next
Response.Redirect "http://www.mydomain.com/404Page.htm"
on error goto 0
Else
on error resume next
Response.Redirect "http://www.mydomain.com/404Page.htm"
End if
%>
--
Betty

RE: custom 404 page works in IE but not firefox

am 03.04.2008 10:50:30 von stcheng

Hi Betty,

In the script code you posted:

============
on error resume next
x = replace(qstr, "404;http://www.mydomain.com:80","")
'404;http://www.mydomain.com:80
x = replace(x,".htm",".asp")

'server.transfer x
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", x
'Response.Redirect x

on error resume next
Response.Redirect "http://www.mydomain.com/404Page.htm"
on error goto 0
==============

I think as long as you add the code to set response status(to 301) and the
new location, you can end the response. However, you still called another
Response.Redirect, is this your original code logic? Or is the following
code is necessary?

============
x = replace(qstr, "404;http://www.mydomain.com:80","")

x = replace(x,".htm",".asp")

Response.Status="301 Moved Permanently"
Response.AddHeader "Location", x
============

I've tested in my local box with Firefox browser, seem it can correctly
perform the redirection.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/de fault.aspx#notif
ications.


This posting is provided "AS IS" with no warranties, and confers no rights.






--------------------
>From: =?Utf-8?B?YzY3NjIyOA==?=
>Subject: custom 404 page works in IE but not firefox
>Date: Wed, 2 Apr 2008 16:24:00 -0700
>
>Hi all,
>
>A couple of months ago. I posted a thread and asked for help for redirect
>all our site *.htm pages to *.asp pages because of our site upgrade almost
>all *.htm to *.asp.
>So some community members suggested use custom error page and redirect the
>page to the same file but different ext. *.asp and it works fine in IE.
But
>when we tested in firefox today. it is not working. I wonder why? It is
>because firefox return different format qstr? can you give me some clue.
How
>can I display the qstr in broswer in order to investigate it?
>here is the code:
>
><% ' vbs
>qstr = Request.ServerVariables("QUERY_STRING")
>
>If instr(lcase(qstr),".htm")>0 then
> on error resume next
> x = replace(qstr, "404;http://www.mydomain.com:80","")
>'404;http://www.mydomain.com:80
> x = replace(x,".htm",".asp")
>
> 'server.transfer x
> Response.Status="301 Moved Permanently"
> Response.AddHeader "Location", x
> 'Response.Redirect x
>
> on error resume next
> Response.Redirect "http://www.mydomain.com/404Page.htm"
> on error goto 0
>Else
> on error resume next
> Response.Redirect "http://www.mydomain.com/404Page.htm"
>End if
>%>
>--
>Betty
>

RE: custom 404 page works in IE but not firefox

am 03.04.2008 15:38:36 von exjxw.hannivoort

Steven Cheng [MSFT] wrote on 03 apr 2008 in
microsoft.public.inetserver.asp.general:

> ============
> x = replace(qstr, "404;http://www.mydomain.com:80","")
> x = replace(x,".htm",".asp")
> Response.Status="301 Moved Permanently"
> Response.AddHeader "Location", x
> ============
>

But what would happen, Steven,
if I requested a nonexisting page?

An infinite loop? No nornmal 404 warning?

Try this:
[Nonexisting .asp versions wil be flagged,
in the second redirect to the 404.asp]

============

if lcase(right(qstr,4) = ".htm" then
x = replace(qstr, "404;http://www.mydomain.com:80","")
x = replace(x,".htm",".asp")
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", x
Response.End
end if
%>
This is the 404 page.


We are so sorry for you.


The requested page <%=qstr%> does not exist.

============

Even then the acting on the default file of the root
and other directories should be considered and changed.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

RE: custom 404 page works in IE but not firefox

am 04.04.2008 07:49:00 von betty

thanks Evertjan and Steven.
I got it. It seems that on error resume next really messed up something.
that's really a big from you guys and because of my predefined launch day
tomorrow.

:=) thanks thanks.
--
Betty


"Evertjan." wrote:

> Steven Cheng [MSFT] wrote on 03 apr 2008 in
> microsoft.public.inetserver.asp.general:
>
> > ============
> > x = replace(qstr, "404;http://www.mydomain.com:80","")
> > x = replace(x,".htm",".asp")
> > Response.Status="301 Moved Permanently"
> > Response.AddHeader "Location", x
> > ============
> >
>
> But what would happen, Steven,
> if I requested a nonexisting page?
>
> An infinite loop? No nornmal 404 warning?
>
> Try this:
> [Nonexisting .asp versions wil be flagged,
> in the second redirect to the 404.asp]
>
> ============
>
> if lcase(right(qstr,4) = ".htm" then
> x = replace(qstr, "404;http://www.mydomain.com:80","")
> x = replace(x,".htm",".asp")
> Response.Status="301 Moved Permanently"
> Response.AddHeader "Location", x
> Response.End
> end if
> %>
> This is the 404 page.
>

> We are so sorry for you.
>

> The requested page <%=qstr%> does not exist.
>
> ============
>
> Even then the acting on the default file of the root
> and other directories should be considered and changed.
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)
>

RE: custom 404 page works in IE but not firefox

am 04.04.2008 08:02:37 von stcheng

Hi Betty,

Really glad that it works for you.

Have a nice launch day!

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/de fault.aspx#notif
ications.

This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
>From: =?Utf-8?B?YzY3NjIyOA==?=
>References:


>Subject: RE: custom 404 page works in IE but not firefox
>Date: Thu, 3 Apr 2008 22:49:00 -0700

>thanks Evertjan and Steven.
>I got it. It seems that on error resume next really messed up something.
>that's really a big from you guys and because of my predefined launch day
>tomorrow.
>
>:=) thanks thanks.
>--
>Betty
>
>
>"Evertjan." wrote:
>
>> Steven Cheng [MSFT] wrote on 03 apr 2008 in
>> microsoft.public.inetserver.asp.general:
>>
>> > ============
>> > x = replace(qstr, "404;http://www.mydomain.com:80","")
>> > x = replace(x,".htm",".asp")
>> > Response.Status="301 Moved Permanently"
>> > Response.AddHeader "Location", x
>> > ============
>> >
>>
>> But what would happen, Steven,
>> if I requested a nonexisting page?
>>
>> An infinite loop? No nornmal 404 warning?
>>
>> Try this:
>> [Nonexisting .asp versions wil be flagged,
>> in the second redirect to the 404.asp]
>>
>> ============
>>
>> if lcase(right(qstr,4) = ".htm" then
>> x = replace(qstr, "404;http://www.mydomain.com:80","")
>> x = replace(x,".htm",".asp")
>> Response.Status="301 Moved Permanently"
>> Response.AddHeader "Location", x
>> Response.End
>> end if
>> %>
>> This is the 404 page.
>>

>> We are so sorry for you.
>>

>> The requested page <%=qstr%> does not exist.
>>
>> ============
>>
>> Even then the acting on the default file of the root
>> and other directories should be considered and changed.
>>
>> --
>> Evertjan.
>> The Netherlands.
>> (Please change the x'es to dots in my emailaddress)
>>
>