Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Upload file usin MTOM

Upload file usin MTOM

Scheduled Pinned Locked Moved C#
sysadminsecurityhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    abbd
    wrote on last edited by
    #1

    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

    OriginalGriffO 1 Reply Last reply
    0
    • A abbd

      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

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      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."

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups