File upload problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Domac

    #1

    File upload problem

    Hi,

    I want to upload *.jpg files to server using FileUpload control. Hosting is
    shared and administrator informed me that I have to use medium trust level
    to upload files. How to achieve that?

    I get error:

    : The application attempted to perform an operation not allowed by the
    security policy. To grant this application the required permission please
    contact your system administrator or change the application's trust level in
    the configuration file.


    Line 10: FileUpload1.Sav eAs("\images\re s\" & FileUpload1.Fil eName)I
    am new to ASP.NET ?

    Thanks a lot!
    Domac


  • Peter Bromberg [C# MVP]

    #2
    Re: File upload problem

    You have to grant write permissions on the images folder to the ASPNET or
    whatever account your app is running under.
    Peter
    "Domac" <domac@domac.dd wrote in message
    news:ewYRcO6mIH A.4196@TK2MSFTN GP04.phx.gbl...
    Hi,
    >
    I want to upload *.jpg files to server using FileUpload control. Hosting
    is shared and administrator informed me that I have to use medium trust
    level to upload files. How to achieve that?
    >
    I get error:
    >
    : The application attempted to perform an operation not allowed by the
    security policy. To grant this application the required permission please
    contact your system administrator or change the application's trust level
    in the configuration file.
    >
    >
    Line 10: FileUpload1.Sav eAs("\images\re s\" &
    FileUpload1.Fil eName)I am new to ASP.NET ?
    >
    Thanks a lot!
    Domac
    >

    Comment

    • Peter Bromberg [C# MVP]

      #3
      Re: File upload problem

      You have to grant write permissions on the images folder to the ASPNET or
      whatever account your app is running under.
      Peter
      "Domac" <domac@domac.dd wrote in message
      news:ewYRcO6mIH A.4196@TK2MSFTN GP04.phx.gbl...
      Hi,
      >
      I want to upload *.jpg files to server using FileUpload control. Hosting
      is shared and administrator informed me that I have to use medium trust
      level to upload files. How to achieve that?
      >
      I get error:
      >
      : The application attempted to perform an operation not allowed by the
      security policy. To grant this application the required permission please
      contact your system administrator or change the application's trust level
      in the configuration file.
      >
      >
      Line 10: FileUpload1.Sav eAs("\images\re s\" &
      FileUpload1.Fil eName)I am new to ASP.NET ?
      >
      Thanks a lot!
      Domac
      >

      Comment

      • Alexey Smirnov

        #4
        Re: File upload problem

        On Apr 11, 10:13 am, "Domac" <do...@domac.dd wrote:
        Hi,
        >
        I want to upload *.jpg files to server using FileUpload control. Hosting is
        shared and administrator informed me that I have to use medium trust level
        to upload files. How to achieve that?
        >
        I get error:
        >
        : The application attempted to perform an operation not allowed by the
        security policy.  To grant this application the required permission please
        contact your system administrator or change the application's trust level in
        the configuration file.
        >
        Line 10:         FileUpload1.Sav eAs("\images\re s\" & FileUpload1.Fil eName)I
        am new to ASP.NET ?
        >
        Thanks a lot!
        Domac
        MSDN: "For a call to the SaveAs to work, the ASP.NET application must
        have write access to the directory on the server. There are two ways
        that the application can get write access. You can explicitly grant
        write access to the account under which the application is running, in
        the directory in which the uploaded files will be saved.
        Alternatively, you can increase the level of trust that is granted to
        the ASP.NET application."

        http://msdn2.microsoft.com/en-us/lib...as(VS.80).aspx
        http://msdn2.microsoft.com/en-us/lib...4y(VS.80).aspx

        Hope this helps

        Comment

        Working...