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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
SriVaddadiCommented:
0
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.