Invalid postback or callback argument if file size is too large on file upload

Hi,

We have an application allowing the administrator to upload pdfs to the website.

In order to let the administrator uploads large files, we have set httpRuntime on web.config.
<httpRuntime executionTimeout="3600" maxRequestLength="1048576" requestLengthDiskThreshold="8192000"/>

However, recently, we are getting the Invalid postback or callback argument error only when the file being upload is larger than 10MB. If the file is less than ~10MB, the system would upload fine.

If I set <%@ Page EnableEventValidation="false" %>, there will be no error on the page, but the > 10MB pdf would not be uploaded either.

I have tested the application within the same network as the web server (to avoid longer time out issue); the same error appears.

Why does this problem only happen with larger file?
Thank you very much for your help

Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

Open in new window

atomic500Asked:
Who is Participating?
 
Gagan_JauraCommented:
IIS7 will reject any file larger then 30MB by default you can increase this by adding the following code
<security>
 <requestFiltering>
  <requestLimits maxAllowedContentLength=”XXXXXX¿ />
 </requestFiltering>
</security>
0
 
SriVaddadiCommented:
Try adding this into the <system.web> section of your web.config file:

<pages enableEventValidation="false" />

or


Simply add the following call in the PreRender or Render page life cycle then your control should work without having to turn off eventValidation:

      Page.ClientScript.RegisterForEventValidation(this.UniqueID);
0
 
SriVaddadiCommented:
Add  Page.ClientScript.RegisterForEventValidation(this.UniqueID); in OnRender method
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
SriVaddadiCommented:
0
 
atomic500Author Commented:
We tried to remove all the codes except leaving the asp:FileUpload and the submit button on the page, (no data grid, no try/catch in the code, etc). The "Invalid postback or callback argument" error disappears.

When I upload a PDF which is less than 10M, the application uploads the file correctly.

However, when I try to upload a > 10M PDF, the form starts to process but nothing happens, then stopped. It didn't even seem to process the upload function (if I try to throw an exception in the upload function, no error returns).

I have also tried to add <security> <requestFiltering> to the web.config. The application still doesn't work with file > 10M.
0
 
atomic500Author Commented:
thank you very much for everyone help.
at the end, we find out the code and settings were all correct. It was a firewall issue between the machines.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.