File IO Permissions error on folder

Discussion in 'General troubleshooting' started by anibol, May 14, 2010.

  1. Hi, i've an application that upload images to the server and creates folders for the different items. When i try to upload an image i get this error:

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

    As i read i have checked with IIS that the application is configured to "Full (Internal)" and as i have read the anonymous ASP user has read/write permissions so i can't understand why i get this error.

    Locally my application runs ok so it's not a code failure. This is the code:

    if (!Directory.Exists(Server.MapPath("..\\upload\\anuncios\\" + tRef.Text)))
    Directory.CreateDirectory(Server.MapPath("..\\upload\\anuncios\\" + tRef.Text));
    fileUp.SaveAs(Server.MapPath("..\\upload\\anuncios\\" + tRef.Text + "\\" + fileUp.FileName));

    The "..\\" is because i am inside the "admin" folder and i need to go up to root folder where the "upload\anuncios" folder is and the application must create "upload\anuncios\X" folder and upload the image inside.

    Any help? Thanks
     
  2. Ray

    Ray

    Last edited by a moderator: Oct 14, 2015

Share This Page