|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Test if file exists before displaying with XMLHTTP
I have a left menu that is accessed and displayed via XMLHTTP (it resides on
the same server). Some sections of the web site don't have a "menu.asp", so a "Page Not Found" page is returned, which doesn't look great in the menu column.. Is there a way to know if a page exists before using xml.responseText to pull it? (apart from checking the actual text of the returned page to see if it contains error-like words) Thanks Giles (PS using xmlhttp instead of server.execute as the menu-page needs processing before displaying) Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists(filespec)) Then msg = filespec & " exists." Else msg = filespec & " doesn't exist." End If if you do not know the physical path you can try this Set pc = Server.CreateObject("MSWC.PermissionChecker") pc.HasAccess(url) if you have permissions the file must exist I have not checked this, but its worth a try Show quote "Giles" <giles@nospam.com> wrote in message news:OkkGXjmTGHA.4976@TK2MSFTNGP11.phx.gbl... >I have a left menu that is accessed and displayed via XMLHTTP (it resides >on the same server). Some sections of the web site don't have a "menu.asp", >so a "Page Not Found" page is returned, which doesn't look great in the >menu column.. Is there a way to know if a page exists before using >xml.responseText to pull it? > (apart from checking the actual text of the returned page to see if it > contains error-like words) > Thanks > Giles > (PS using xmlhttp instead of server.execute as the menu-page needs > processing before displaying) >
Show quote
"Giles" <giles@nospam.com> wrote in message Just test the XMLHTTP.Status property after attempting to fetch it. If it'snews:OkkGXjmTGHA.4976@TK2MSFTNGP11.phx.gbl... > I have a left menu that is accessed and displayed via XMLHTTP (it resides on > the same server). Some sections of the web site don't have a "menu.asp", so > a "Page Not Found" page is returned, which doesn't look great in the menu > column.. Is there a way to know if a page exists before using > xml.responseText to pull it? > (apart from checking the actual text of the returned page to see if it > contains error-like words) > Thanks > Giles > (PS using xmlhttp instead of server.execute as the menu-page needs > processing before displaying) > > 404 the file didn't exist and the responseText will contain the sites 404 content. Anthony |
|||||||||||||||||||||||