Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

dbf2mysql parameter, WWWXXXAPC, wwwxxxAPC, How to unsubscrube from dategen spam, docmd.close 2585, WWWXXXDOCO, nu vot, dhcpd lease file "binding state", WWWXXXDOCO, how to setup procmail to process html2text

Links

XODOX
Impressum

#1: custom 404 page works in IE but not firefox

Posted on 2008-04-03 01:24:00 by 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

Report this message

#2: RE: custom 404 page works in IE but not firefox

Posted on 2008-04-03 10:50:30 by 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==?= <betty@newsgroup.nospam>
>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
>

Report this message

#3: RE: custom 404 page works in IE but not firefox

Posted on 2008-04-03 15:38:36 by 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.
<br>
We are so sorry for you.
<br>
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)

Report this message

#4: RE: custom 404 page works in IE but not firefox

Posted on 2008-04-04 07:49:00 by 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.
> <br>
> We are so sorry for you.
> <br>
> 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)
>

Report this message

#5: RE: custom 404 page works in IE but not firefox

Posted on 2008-04-04 08:02:37 by 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==?= <betty@newsgroup.nospam>
>References: <DBB06639-02B5-487F-9485-F34C660EDD78@microsoft.com>
<j$V2LfWlIHA.4932@TK2MSFTNGHUB02.phx.gbl>
<Xns9A759F1F66D1Feejj99@194.109.133.242>
>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.
>> <br>
>> We are so sorry for you.
>> <br>
>> 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)
>>
>

Report this message