Upload file usin MTOM
-
Hello, I want to make a web service that receive files using MTOM:
[WebMethod]
public void Upload(string FileName, byte[] buffer, long Offset)
{
string FilePath = Path.Combine(UploadPath, FileName);using (FileStream fs = new FileStream(FilePath, FileMode.Open, FileAccess.ReadWrite, FileShare.Read)) { fs.Seek(Offset, SeekOrigin.Begin); fs.Write(buffer, 0, buffer.Length); } }
i have this error : System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.UnauthorizedAccessException: Access to the path 'C:\MTOM\AA' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) at MTOM.Service1.Upload(String FileName, Byte[] buffer, Int64 Offset) in C:\Documents and Settings\Administrateur\Bureau\MTOM\MTOM\MTOM.asmx.cs:line 41
-
Hello, I want to make a web service that receive files using MTOM:
[WebMethod]
public void Upload(string FileName, byte[] buffer, long Offset)
{
string FilePath = Path.Combine(UploadPath, FileName);using (FileStream fs = new FileStream(FilePath, FileMode.Open, FileAccess.ReadWrite, FileShare.Read)) { fs.Seek(Offset, SeekOrigin.Begin); fs.Write(buffer, 0, buffer.Length); } }
i have this error : System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.UnauthorizedAccessException: Access to the path 'C:\MTOM\AA' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) at MTOM.Service1.Upload(String FileName, Byte[] buffer, Int64 Offset) in C:\Documents and Settings\Administrateur\Bureau\MTOM\MTOM\MTOM.asmx.cs:line 41
There is a discussion here which looks relevant: http://www.velocityreviews.com/forums/t99263-unauthorizedaccessexception.html[^]
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."