 |
| Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

June 19th, 2003, 07:43 AM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
"Page cannot be displayed"
Hello,
I have a web page which automatically refresh itself and redirect to another page for 30 sec and then refresh and redirect back to the main page and the cycle begins again after 3 minutes on the main page.
The page that gets redirected to is our Intranet home page and sometimes it's down and so I get this "Page cannot be displayed" on the screen.
Is there a way to find out, after loading a page, whether it failed or not?
The redirect is between two .asp pages.
Thank you
A.Delcy
Web Administrator
Canada
__________________
A.Delcy
Developer
Canada
|
|

June 19th, 2003, 09:32 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
You can force your browser to display more particular error message than "Page cannot be displayed". Go to Tools/Internet Options/Advanced and uncheck "Show friendly HTTP eroor messages". Then you'll see developer friendly error message on the page.
...but the Soon is eclipsed by the Moon
|
|

June 19th, 2003, 10:02 AM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thank you for your reply.
I guess my point is more towards finding a way to do something if case I get this "Page cannot be displed".
I don't really want to know the actuall error but rather do something in case it happens.
Page 1 is refresh and redirect to Page 2. In 30 seconds, Page 2 now refresh and redirect to back to Page 1.
My problem is that sometimes, Page 2 does not can display, so when it happens that Page 2 does not can display, I want Page 1 to know about it and therefore redirect to dummyRedirect page which redirect right back to the Page 1.
In .aspx project I did it in the web config file but .asp project doen't have the web config file.
Thank you
A.Delcy
Web Administrator
Canada
|
|

June 19th, 2003, 11:35 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
You can use this function to check the status of the page 2 before the redirection:
Code:
Function CheckPageStatus(PageToCheck)
Dim objXMLHTTP
dim StatusOK
set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
objXMLHTTP.Open "GET", PageToCheck, false
objXMLHTTP.Send
if objXMLHTTP.status=200 then
StatusOK=1
else
StatusOK=0
End If
CheckPageStatus=StatusOK
Set objXMLHTTP= Nothing
End Function
...but the Soon is eclipsed by the Moon
|
|

June 20th, 2003, 07:59 AM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks alot for the help.
I will try that and I also would call the Intranet page from within a frame. So, Page 2 will be a page with a frame and the frame will load the Intranet page. I will use your function to test if the Intranet page is ok then do nothing else I will redirect back to page 1.
Thank you
A.Delcy
Web Administrator
Canada
|
|

June 20th, 2003, 09:42 AM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hello,
I have tried the code that you have sent me and I found that the function always return the status code 404.
Please try the following code and let me know if it works.
I am running it from InterDev, right clicking and selecting browse.
Thank you
-----Code Start
<%
Function CheckPageStatus(strPage)
Dim objXMLHTTP
dim StatusOK
set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
objXMLHTTP.Open "GET", strPage, false
objXMLHTTP.Send
'if objXMLHTTP.status=200 then
StatusOK = objXMLHTTP.status
'else
' StatusOK=0
'End If
CheckPageStatus=StatusOK
Set objXMLHTTP= Nothing
End Function
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<%
intReturn = CheckPageStatus("http://insidewyeth.com/waci")
if intReturn = 0 then %>
<IFRAME ID=IFrame1 FRAMEBORDER=1 SCROLLING=NO width="100%" height="99%" SRC="PageFailed.asp"></IFRAME>
<%else%>
<IFRAME ID=IFrame1 FRAMEBORDER=1 SCROLLING=NO width="100%" height="99%" SRC="HTML Page1.htm"></IFRAME>
<%end if%>
<br> This is the number returned :
<%=intReturn%>
</BODY>
</HTML>
----Code ends
A.Delcy
Web Administrator
Canada
|
|

June 22nd, 2003, 02:58 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Maybe you can try with ServerXMLHTTP object rather thatn XMLHTTP object.
(set objXMLHTTP = Server.CreateObject("MSXML2.Serverxmlhttp") instead of set objXMLHTTP = Server.CreateObject("Microsoft.xmlhttp") in the function body)
In order to work properly ServerXMLHTTP's proxy settings has to be configured using the proxycfg.exe tool. For more info -http://support.microsoft.com/support/kb/articles/Q289/4/81.ASP.
HTH.
...but the Soon is eclipsed by the Moon
|
|
 |