Results 1 to 5 of 5

Thread: [2005] Verifying remote folder exists

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    [2005] Verifying remote folder exists

    I use this function to check whether a remote file or website exists...

    VB Code:
    1. Public Function CheckURLExists(ByVal site As String) As Boolean
    2.         Dim Success As Boolean
    3.         Dim objUrl As New System.Uri(site)
    4.         Dim objWebReq As System.Net.WebRequest
    5.         Dim objResp As System.Net.WebResponse
    6.         objWebReq = System.Net.WebRequest.Create(objUrl)
    7.         Try
    8.             objResp = objWebReq.GetResponse
    9.             objResp.Close()
    10.             Success = True
    11.         Catch ex As Exception
    12.             Success = False
    13.         End Try
    14.         objWebReq = Nothing
    15.         Return Success
    16.     End Function
    But this does will not work when checking whether a remote folder exists (it produces a 'forbidden' error with no exception thrown). Does anyone have a function/sub for this?

    p.s. I have been searching MSDN for info but cant find anything.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: [2005] Verifying remote folder exists

    Please don't create duplicate threads.

    http://www.vbforums.com/showthread.php?t=447315
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Re: [2005] Verifying remote folder exists

    This isnt the same issue.

    This thread concerns a method to verify the presence of a remote folder (I showed the code I currently use to test for the presence of sites and files).

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: [2005] Verifying remote folder exists

    My apologies. I should read more carefully.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Re: [2005] Verifying remote folder exists

    For services rendered to 18,678 hapless programmers like me, you are forgiven.

Posting Permissions

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



Click Here to Expand Forum to Full Width