Skip to content

Codepolice

  • ⤫

Request.Files is Empty in a Web Forms Application

Posted by Judy Alvarez Posted on February 28, 2022March 1, 2022
0

I was fixing some bugs in my application today and ran into a tricky bug. My application is based on Webforms but I use a lot of jQuery and other more modern technologies. In one place I have an upload form that is dynamically populated with jQuery templates. Since i create all my <input type”file”> with jQuery i can’t use ASP.NET’s built-in <asp:FileUpload>, i can’t even have then as “runat=server”.

Today when I made some changes I removed the last file upload that had runat=” server” on it and a couple of hours later I noticed that all uploads had stopped working. After some debugging it hit me that I should check if the “auto-generated” form that asp.net ads to each page had the enctype=” multipart/form-data” attribute still. And of course, that was gone.

Naturally, ASP.NET removed that attribute when I removed the last file upload that had “runat=server”. So if you do not want any file upload that has runat=server or <asp:fileupload> you have to add type manually to your form.

Page.Form.Enctype = "multipart/form-data";
Categories: JavascriptTagged: asp dot net developers, asp net bootstrap, asp net core web app, asp net developers india, asp net development company usa, asp net development outsourcing, asp net for web development, asp net html to pdf, asp net mvc 3, asp net mvc grid, asp net mvc page life cycle, asp net mvc pdf, asp net mvc session management, asp net mvc shopping cart, asp net mvc with angularjs, asp net technology, asp net themes, asp net vs, asp net vs django, asp net web api 2, asp net web form, asp net webapp, asp net websites, asp. net mvc interview questions, docker asp net, mvc example in asp net, shopping cart asp net c# step by step, web development asp net, web development with asp net, www dadeschools net students asp

Post navigation

Previous Previous post: Using log4net to Send Mail With SmtpAppender In a Console Application
Next Next post: Build, Git Commit, FTP When You Publish In Visual Studio

Related Posts

  • Package efficiency and dependency hygiene

    #​752 — September 12, 2025 Read on the Web If you have any interest in music and being able to render music or generate music with JavaScript, be sure to check out the very end of this issue where we’ve dedicated an entire section to the topic 🙂__Your editor, Peter Cooper JavaScript Weekly How to Keep

    Posted by Posted on September 12, 2025
    0
  • A significant supply chain attack on the npm ecosystem

    #​592 — September 9, 2025 Read on the Web A Major Supply Chain Attack Hits the npm Ecosystem — In July, Socket warned us about a phishing campaign targeting npm package publishers. Sadly, a prolific package author (among others, like DuckDB, who explain how the attack worked on them) fell victim to the scam, resulting

    Posted by Posted on September 9, 2025
    0
  • Why browsers throttle JavaScript timers (and what to do about it)

    #​751 — September 5, 2025 Read on the Web JavaScript Weekly Mediabunny: A Complete Media Toolkit for JavaScript — Supporting both browsers and Node.js, this library lets you read, write and convert popular media file formats (e.g. MP4, MP3, and more) without needing to lean on dependencies like FFmpeg. You can make thumbnails, extract metadata,

    Posted by Posted on September 5, 2025
    0
  • The latest on Oracle’s hold on JavaScript

    #​750 — August 29, 2025 Read on the Web JavaScript Weekly An Illustrated Guide to Big O and Time Complexity — A fantastic JavaScript-oriented, interactive, visual essay about Big O notation and its role in describing algorithmic complexity. This is a beautiful bit of work, even if you’re already wise to O(log n) and O(n^2).

    Posted by Posted on August 29, 2025
    0
  • The productivity benefits from type stripping

    #​591 — August 26, 2025 Read on the Web How We Migrated Our Rush.js Monorepo to Node Type Stripping — Since v23.6 (and in LTS since v22.18.0), Node has supported running (most) TypeScript code by stripping the types out first. The Calm team was excited about the potential for improving productivity and DX, and set

    Posted by Posted on August 26, 2025
    0
  • We still love jQuery

    #​749 — August 22, 2025 Read on the Web ☀️ We’re back after a week off, though I’m starting to think we should have taken two weeks off as it’s been quite quiet in JavaScript-land this August! Nevertheless, we still have a full issue for you today, so let’s get on to it.. 😉__Peter Cooper, your

    Posted by Posted on August 22, 2025
    0
Judy Alvarez

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Codepolice

  • Github
  • Atlassian
  • Flatlogic
  • Xero
  • Jetbrains
  • Figma
  • Package efficiency and dependency hygiene
  • A significant supply chain attack on the npm ecosystem
  • Why browsers throttle JavaScript timers (and what to do about it)
  • The latest on Oracle’s hold on JavaScript
  • The productivity benefits from type stripping
https://flatlogic.com/generator
COPYRIGHT © 2025 - Codepolice