{"id":125,"date":"2010-05-13T15:30:37","date_gmt":"2010-05-13T10:00:37","guid":{"rendered":"http:\/\/JitendraZaa.com\/blog\/?p=125"},"modified":"2010-05-13T15:30:37","modified_gmt":"2010-05-13T10:00:37","slug":"cannot-access-a-closed-file-fileupload-in-asp-net","status":"publish","type":"post","link":"https:\/\/www.jitendrazaa.com\/blog\/microsoft\/net\/cannot-access-a-closed-file-fileupload-in-asp-net\/","title":{"rendered":"cannot access a closed file &#8211; FileUpload in ASP.NET"},"content":{"rendered":"<p>This was very\u00a0interesting\u00a0error, i got during development of file upload control in ASP.NET.<\/p>\n<p>On my local system, every thing was just fine. but when i deployed my application on development server, my control was able to upload only small size files.<\/p>\n<p>whenever i tried to upload large size file i got error <span style=\"color: #ff0000;\">&#8220;cannot access a closed file&#8221;<\/span><\/p>\n<p><span style=\"color: #ff0000;\"><span style=\"color: #000000;\">After going through MSDN i found that there is one new element added in ASP.NET 2.0 known as <strong>httpRuntime.<\/strong><\/span><\/span><\/p>\n<p><span style=\"color: #ff0000;\"><span style=\"color: #000000;\"><strong><\/strong>So i just added this new Tag in my <strong>web.config<\/strong> and every thing was right.<\/span><\/span><\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\n&lt;system.web&gt;\n&lt;httpRuntime  maxRequestLength=&quot;15360&quot; requestLengthDiskThreshold=&quot;15360&quot;\/&gt;\n&lt;\/system.web&gt;\n<\/pre>\n<h3><strong><span style=\"color: #ff0000;\"><span style=\"text-decoration: underline;\">Note : <\/span><\/span><\/strong><\/h3>\n<pre><span style=\"font-family: 'Segoe UI', Verdana, Arial; white-space: normal; font-size: 13px; border-collapse: collapse; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px;\"><strong>requestLengthDiskThreshold\u00a0<span style=\"font-weight: normal;\">should not exceed the\u00a0<strong>maxRequestLength<\/strong>attribute.<\/span><\/strong><\/span>\n<span style=\"font-family: 'Segoe UI', Verdana, Arial; white-space: normal; font-size: 13px; border-collapse: collapse; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px;\"><strong><\/strong><\/span>\n<span style=\"font-family: 'Segoe UI', Verdana, Arial; white-space: normal; font-size: 13px; border-collapse: collapse; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px;\"><strong><span style=\"font-weight: normal;\">To read more about this, please visit\u00a0<span style=\"border-collapse: separate; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px;\"><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/e1f13641(VS.80).aspx\">http:\/\/msdn.microsoft.com\/en-us\/library\/e1f13641(VS.80).aspx<\/a><\/span><\/span><\/strong><\/span>\n<span style=\"font-family: 'Segoe UI', Verdana, Arial; white-space: normal; font-size: 13px; border-collapse: collapse; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px;\"><strong><span style=\"font-weight: normal;\">\n<\/span><\/strong><\/span><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This was very\u00a0interesting\u00a0error, i got during development of file upload control in ASP.NET. On my local system, every thing was just fine. but when i deployed my application on development server, my control was able to upload only small size files. whenever i tried to upload large size file i got error &#8220;cannot access a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":331,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"jz_research_post":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[21],"tags":[43,100],"class_list":["post-125","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-net","tag-asp-net","tag-fileupload"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":132,"url":"https:\/\/www.jitendrazaa.com\/blog\/microsoft\/net\/upload-files-in-asp-net-at-production-server\/","url_meta":{"origin":125,"position":0},"title":"Upload Files in ASP.NET at Production server","author":"Jitendra","date":"May 13, 2010","format":false,"excerpt":"In this article, i am going to demonstrate that how to upload the file in ASP.NET production server. Most of the case, a developer created a code to upload the file and test it on his local machine. program runs smoothly, but as he\u00a0forward\u00a0the same code on production. He\u00a0stuck\u00a0in the\u2026","rel":"","context":"In &quot;ASP.NET&quot;","block_context":{"text":"ASP.NET","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/microsoft\/net\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2010\/05\/WebShare-Folder.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":71,"url":"https:\/\/www.jitendrazaa.com\/blog\/webtech\/web\/style-file-upload-control-in-asp-html\/","url_meta":{"origin":125,"position":1},"title":"Style File upload control in ASP \/ HTML","author":"Jitendra","date":"May 10, 2010","format":false,"excerpt":"As most of us know that we cannot style the file upload control to much level, still we can give it a stunning effect with the help of CSS. There is nothing in code to explain. I took three upload control and one button to give effect. Lets say upload\u2026","rel":"","context":"In &quot;HTML&quot;","block_context":{"text":"HTML","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/webtech\/web\/"},"img":{"alt_text":"Output in Chrom","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2010\/05\/Output-in-Chrom-300x82.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":258,"url":"https:\/\/www.jitendrazaa.com\/blog\/microsoft\/net\/tracing-asp-net-website\/","url_meta":{"origin":125,"position":2},"title":"Tracing ASP.NET Website","author":"Jitendra","date":"June 28, 2010","format":false,"excerpt":"Demonstrates that how to Trace ASP.NET web applications","rel":"","context":"In &quot;ASP.NET&quot;","block_context":{"text":"ASP.NET","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/microsoft\/net\/"},"img":{"alt_text":"ASP.NET Tracing Output","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2010\/05\/Tracing-FirstPage1.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2299,"url":"https:\/\/www.jitendrazaa.com\/blog\/microsoft\/net\/tutorial-read-and-export-excel-file-in-asp-net-using-c\/","url_meta":{"origin":125,"position":3},"title":"Tutorial &#8211; Read and export excel file in ASP.Net  using C#","author":"Jitendra","date":"July 29, 2011","format":false,"excerpt":"Tutorial - Read and export excel file in ASP.Net using C#","rel":"","context":"In &quot;ASP.NET&quot;","block_context":{"text":"ASP.NET","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/microsoft\/net\/"},"img":{"alt_text":"Read And Export Excel in ASP.Net","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2011\/07\/Read-And-Export-Excel-in-ASP.Net_.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":15,"url":"https:\/\/www.jitendrazaa.com\/blog\/microsoft\/net\/app_offline-htm-in-asp-net\/","url_meta":{"origin":125,"position":4},"title":"App_Offline.htm in ASP.NET","author":"Jitendra","date":"May 5, 2010","format":false,"excerpt":"If you place a file with the name App_Offline.htm in the root of a web application directory, ASP.NET 2.0 will shut-down the application, unload the application domain from the server, and stop processing any new incoming requests for that application. ASP.NET will also then respond to all requests for dynamic\u2026","rel":"","context":"In &quot;ASP.NET&quot;","block_context":{"text":"ASP.NET","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/microsoft\/net\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":827,"url":"https:\/\/www.jitendrazaa.com\/blog\/webtech\/add-css-programatically-in-asp-net\/","url_meta":{"origin":125,"position":5},"title":"Add CSS Programatically in ASP.NET","author":"Jitendra","date":"September 3, 2010","format":false,"excerpt":"Tutorial on adding the CSS file dynamically in ASP.NET and C# \/ VB.Net","rel":"","context":"In &quot;ASP.NET&quot;","block_context":{"text":"ASP.NET","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/microsoft\/net\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/125","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/comments?post=125"}],"version-history":[{"count":0,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/125\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/media?parent=125"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/categories?post=125"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/tags?post=125"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}