File Create permissions

Discussion in 'Knowledge Base' started by AMateus, Sep 14, 2009.

  1. AMateus

    AMateus Guppy

    Hello all,

    I get this error everytime I try to save a file (net v2):

    Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

    Relevant code:
    Imports System.IO
    Dim sFileName As String = "test.jpg"
    Dim sPath As String = Server.MapPath("/Uploads/")
    Dim s2 As FileStream = New FileStream(sPath & sFileName, FileMode.CreateNew, FileAccess.Write)
    Dim br As BinaryReader = New BinaryReader((TryCast(sender, DevExpress.Web.ASPxUploadControl.ASPxUploadControl)).FileContent)
    Dim bw As BinaryWriter = New BinaryWriter(s2)
    Dim byteRead As Byte
    Dim j As Integer
    br.BaseStream.Seek(0, SeekOrigin.Begin)
    For j = 0 To br.BaseStream.Length() - 1
        byteRead = br.ReadByte
    I have tryed with and without server.mappath! I'm clueless!


    Thanks in Advance!
  2. Stephen

    Stephen US Operations Staff Member

    if you try to use a path like d:\hshome\user\domain\uploads it will fail, also if you use map path for the same, this is because it needs to access the fiel via the virtual path only. Access permissions are restricted to the appdir only, so any physical path at all will bomb out.
  3. AMateus

    AMateus Guppy

    Solved with the help fo the online support!!!

    For the record, code is the same, so I really don't know what changes have been made.

    António Mateus
  4. DaveMcTKD

    DaveMcTKD Guppy

    I had the same issue, and asked them. The reply was"Sorry,you do not have privilege to edit permission."
  5. Manish

    Manish Bass

    DaveMCTKD, Please give me your ticket ID so, i can check issue and give you possible solution.
  6. DaveMcTKD

    DaveMcTKD Guppy

    The ticket was EKP-37171-822 .
    The problem of writing to an existing file is resolved.
    However, my application is not able to upload / create new files. FTP or file manager is required for that.
    The websites I build use Telerik RadEditor so that end users may modify page content themselves. In the process, they may want to uppload a file (.pdf,.jpg,.gif, etc). The RadEditor has a file upload tool that requires Full Trust permissions, and cannot work properly at Medium Trust I belive.
    This Forum uses a very similar editor, and allows for upload of images - what trust level is used to create the upload files?
  7. Stephen

    Stephen US Operations Staff Member

    This forum is PHP on a dedicated server :D

Share This Page

JodoHost - 26,000 hosting end-users in 100 countries
Plesk Web Hosting
VPS Hosting
H-Sphere Web Hosting
Other Services