FileUpload Control causes 500 error

Source: Internet
Author: User

Problem:

Today, you encounter a problem, upload an Excel file with the FileUpload control, invoke the "Fileupload1.saveas" method with a button control, and a server 500 error occurs when you click the button. Such as:

  

Workaround:

In the button event break point, debugging code, found that there is no event, a direct 500 error, should not be a code bug.

Later found that the file 4.28M, is not more than the default limit (the default maximum seems to be 4M)? The

  Summary :

It is not difficult to understand carefully. When you click the button and the page is posted back to the server, the ASP. NET internal mechanism should be to upload the file directly to the server. Although the fileupload of the SaveAs method is to upload the file, but in fact, as long as the postback page file has been uploaded. Otherwise, there is no chance of uploading in this life cycle.

The reason for reporting a 500 error directly is the error reported by IIS according to the configuration. At this time, there is no back-end code to take over, so that there is no point above the phenomenon of a breakpoint.

It seems that the server control pit is still quite large, there are strange problems, it is necessary to think about its implementation principle, the problem is not difficult to solve.

FileUpload Control causes 500 error

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.