1
서버 경로에 파일을 쓰고 싶습니다.하지만 그렇게하려고 할 때 우리는 예외적 인 권한을 가지고 있습니다. 우리는 서버 경로에 쓸 수있는 권한이있는 응용 프로그램의 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();
컴파일되지 않았습니다. '외부'이름이 현재 컨텍스트에 없습니다. –
이 사용자에게 필요한 권한은 무엇입니까? 처음에는 –
@ thabet084 예외가 있으므로 전체 권한을 가진 사용자를두고 위의 코드에 세부 정보를 입력하십시오. –