を削除するには接続できない場合に例外をスローし、これまでに以下のように、私のコードは次のとおりです。C#のサーバーに、私は私の方法で関数が失敗した場合にスローされた例外を取得しようとしています
if (sourceFile.Exists)
// Would be nice to add ticker/spinner, while the file header on the remote server is being read!!
{
var request = (HttpWebRequest)WebRequest.Create(@"http://google.com/test.zip");
request.Method = "HEAD";
var response = (HttpWebResponse)request.GetResponse();
if (response.LastModified > sourceFile.LastWriteTime)
{
Download_Click(sender, e);
// use response.GetStream() to download the file.
}
ご質問はありますか? –
@ba__friendどのようにネットワーク接続が利用できない場合、例外をキャッチすることができます –
助けてください、それはすでに起こります。 –