FileUploadControl.HasFile always returns false.

When I tried using HttpFileCollection

HttpFileCollection files = Request.Files;

after adding System.Web Namespace it says 'Request' does not exists in the current context.

Is there any way to use asp.net FileUpload control in sharepoint sandbox?

2 Answers 2


This is prohibited by the Sandbox user process and the sandboxed object model. Most properties of the ASP.NET objects (such as Page, Request, Response etc) are marshalled from the w3wp.exe process to the user code process into new "sandboxed" copies of these objects. The Request.Files property is on of those objects that is not copied. It's more of a resource issue than a security issue.

  • The requirement is to upload files to Document library from FileUpload Control, is there any other way to do this, in sandbox solution.
    – Marcus
    Mar 27, 2012 at 13:48
  • You can use a Silverlight app to achieve this. Mar 27, 2012 at 16:25

you can't do that because this is a security issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.