C# WebClient如何远程写入文本,注意,要以追加形式写入文本。。
代码如下,已经实现了远程写入,但是只能是每次都把文本文件覆盖掉了。。怎么才能追加着写。。求赐教
public static bool WriteToServer(string content, string serverPath)
{
WebClient client = new WebClient();
try
{
Stream stream = client.OpenWrite(serverPath, "PUT");
StreamWriter sw = new StreamWriter(stream);
sw.WriteLine(content);
sw.Close();
stream.Close();
return true;
}
catch(Exception e)
{
return false;
}
}