473,396 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

check if a file exists on a web server

Hello,

I am developing a windows service application that checks
if a particular web page is on the web server. I found
there is a method called File.exists(path) to check it,
but how can I get absolute path of a web page in a windows
application rather than a web application? In a web
application, we can use Server.MapPath(mypath) to get
absolute path.

Thanks in advance.

Jane
Nov 22 '05 #1
3 3275
This funtion should do the trick

Private Function FileExists(ByVal strFileName As String) As Boolean
Dim FileFound As String

On Error GoTo 0
FileFound = Dir(strFileName)
If Len(FileFound) = 0 Then
FileExists = False
Else
FileExists = True
End If
End Function

HTH

Russ

"Jane" <an*******@discussions.microsoft.com> wrote in message
news:01****************************@phx.gbl...
Hello,

I am developing a windows service application that checks
if a particular web page is on the web server. I found
there is a method called File.exists(path) to check it,
but how can I get absolute path of a web page in a windows
application rather than a web application? In a web
application, we can use Server.MapPath(mypath) to get
absolute path.

Thanks in advance.

Jane

Nov 22 '05 #2
I don't know the actual source code to use right off hand (too lazy to try
it out :-) However, check out the HttpWebRequest class. I've seen this
class used in other examples to test for the existence of a web page given a
URL to test (e.g. http://www.mydomain.com/somefile.html).

--
Thanks, Jeff

"Jane" <an*******@discussions.microsoft.com> wrote in message
news:01****************************@phx.gbl...
Hello,

I am developing a windows service application that checks
if a particular web page is on the web server. I found
there is a method called File.exists(path) to check it,
but how can I get absolute path of a web page in a windows
application rather than a web application? In a web
application, we can use Server.MapPath(mypath) to get
absolute path.

Thanks in advance.

Jane

Nov 22 '05 #3
Take a look at this little project. It way help
http://www.russgreen.net\software\do...iveUpdater.zip

Russ
"Jane" <an*******@discussions.microsoft.com> wrote in message
news:01****************************@phx.gbl...
Hello,

I am developing a windows service application that checks
if a particular web page is on the web server. I found
there is a method called File.exists(path) to check it,
but how can I get absolute path of a web page in a windows
application rather than a web application? In a web
application, we can use Server.MapPath(mypath) to get
absolute path.

Thanks in advance.

Jane

Nov 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mike | last post by:
I´ve got a number of SPAN elements named "mySpan1", "mySpan2", "mySpan3" etc, and want to set their "style.display" to "inline". This works (only needs to work on IE5.5+): for (var x = 1; x <...
3
by: newcomer | last post by:
Is there a way to check if a file exists in Javascript? This is what I'm trying to do: if(thisfile.htm exists) do this else do that
3
by: Jane | last post by:
Hello, I am developing a windows service application that checks if a particular web page is on the web server. I found there is a method called File.exists(path) to check it, but how can I get...
3
by: Matt | last post by:
The user can select a file in the file open dialog using <input type="FILE">, but the user can also enter the full file path in the browse text box manually. My question is if there are JavaScript...
1
by: Pgar | last post by:
I have a page that I have the users uploading files from their local machines. I take these files strip off their path and redirect it to a new file on the web server. I have a virtual directory...
2
by: Adrian | last post by:
hi I'm writing, or trying to! an ASP page that checks if a file exists and if so transfers it. the use sends a query string with the name of the file, I have this bit working, but need to check...
2
by: www.MessageMazes.com | last post by:
Greetings, I'm experimenting with an ASP page that reads data from a file name that is passed to it as a parameter, as in this page, which works, because the "good" file exists. ...
3
by: laredotornado | last post by:
Hello, Using PHP 4, how do you check if a file exists on an FTP server given its connection information and a directory to check? Thanks, - Dave
3
by: trint | last post by:
How can I do this with my c# code with my website(because the file is there, but the code doesn't return it)?: if(File.Exists(String.Format("~/images/categories/{0}", sFileName)) return...
8
by: Alan | last post by:
Hello, I need to write a systemtray program to check every minute if a certain intranet page exists. Would "webBrowser.Navigate" and catching exceptions to it be a good choice in terms of load...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.