Skip to content

File fails to load when network failure

Reetu

Asked Mar 29, 2006, 6:20 AM EST3 answers
Share
LinkedInX
Hi,

How can I go about writing this in C#.

A File fails to load when the network is down.

THank you
Reetu

3 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Well... is the file located on a network drive or on the internet somewhere? Do you need to read and write? If it is on a network drive you could use CopyFileEx with the COPY_FILE_RESTARTABLE which will ensure that it is able to get it once the network comes back up.
    0
  • 0
    The file is currently sitting in my local.

    This is just a scenario that I want my program to handle.

    If the file is on a network and the network is down, I want to be in a position to display  a message: "Failed to load file because of Network Problems"

    And I want this to be in c#.net


    Thanks
    0
  • 0
    When you are trying to access the file when your network is down, it should throw you a trappable exception ( most likely an IOException ) , catch this exception and handle it accordingly (like show a friendly message! )

    Cheers
    0