HOW TO: check the existence of a http file ..

Results 1 to 4 of 4

Thread: HOW TO: check the existence of a http file ..

  1. #1
    ZARk (aka: su root ) Guest

    Default HOW TO: check the existence of a http file ..

    Here&#039s a hard one for you guys ...<BR><BR>I&#039d like to check for the existence of a file anywhere on the net ... <BR>here&#039s an example in pseudo-code<BR>Dim RemoteFile<BR>RemoteFile = ""<BR>If exists RemoteFile then Response.Write "Ok" else Response.Write "Dont exist"<BR><BR>i thought about checking for the http header ...<BR>i know that header : HTTP/1.0 200 OK<BR>means the page exists and that : HTTP/1.0 404 OBJECT NOT FOUND<BR>means the page dont exist ..<BR>now, problem is .. how to make the ASP load the file, check on the http header, and returns an answer based on the header ?<BR><BR>The guy who finds this will get a kiss from my sister :)<BR>&#039cos right now, i&#039m clueless ..<BR><BR>You have the SLIGHTEST idea, or suggestion, let me know<BR>(And don&#039t start by telling me to make a ServerObject in vb please, &#039cos thats what i&#039m thinking of doing right now)<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: HOW TO: check the existence of a http file ..

    Two questions:<BR><BR>1. Do you have the XML parser installed? (MSXML.dll, comes with IE 5 but can be installed separately)<BR>2. Is your sister good-looking?<BR><BR>If the answer to both is yes, I can help you.<BR><BR>The answer is to use the XMLHTTP object that&#039s included in the XML parser to request the URL. Now, we don&#039t care that you&#039re not actaully loading XML &#039cause the only property you&#039re interested in is XMLHttpRequest.Status - if status is "404" then the file doesn&#039t exist.<BR><BR>I have to admit that the idea isn&#039t entirely mine - credit is due to Alex Homer for his article on the subject on ASP Today at<BR><BR>Cheers<BR><BR>Dunc

  3. #3
    Imran Qureshi Guest

    Default RE: HOW TO: check the existence of a http file ..

    This could be a WebDav issue !<BR>However, can the filesystem object be extended to make use of this functionality ? The file exists method will give you TRUE/FALSE depending on whether or not the file is available or not !<BR><BR>I havent delved into ASP 3 yet, may be its in the newest flavour.<BR><BR>If this fails, check for any components that may do this already !<BR><BR>Good luck,<BR><BR>IQ

  4. #4
    Zark (aka: su root) Guest

    Default RE: HOW TO: check the existence of a http file .. have ASPHTTP ... but well how to say this .. $$$$$$$$$<BR>and it&#039s a server side component, and if i wanted one, i&#039d make on in VisualBasic .. not very hard .. using Winsock to connect to port 80 and send the string : "GET " & pathtofile ..<BR>then listen for the 50first characters, and just make a case with the answer ...<BR><BR>I&#039m going to try FileSystemObject but i doubt it....<BR><BR>HAve tried the other solution, by that other guy who answered with an article about XMLHTTP ... am trying, but for some reason, even the examples mentioned in the article dont werk, and i&#039m using the same Parser version as the writer :(<BR>All i ever get is .. no reply .. script just runs, and, blank internet explorer :(<BR><BR>I found an alternate solution though ..<BR>but an image on the server i wanted to check on..<BR>and in my html i have a img src="" ALT="ERROR : SERVER NOT AVAILABLE"<BR>so, if the picture (1k) doesnt load, the server is thus out of order, and the page i want available wouldnt load, so the user knows not to click ...<BR><BR>Well, better than nothing ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts