我想在服务器路径上写一个文件,但是当我尝试这样做时,我们得到了异常,我们无权这样做。我们有一个有权在服务器路径上写入的应用程序 ID 和密码,但我不知道如何传递此凭据:
我当前的代码:
//Create a new GUID, extract the extension and create a new unique filename
string strFileGUID = System.Guid.NewGuid().ToString();
string extension = Path.GetExtension(attachment.AttachmentFileName);
string tempfilename = strFileGUID + extension;
string path = "ServerPath";
//Open a filestream and write the contents of the file at server path
FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write );
fs.Write(fileContent.Content, 0, fileContent.Content.Length);
fs.Flush();
fs.Close();