1

I have an ASP.NET 4.0 web application where users upload videos to the server. I have a FileUpload control and 2 DropDownLists.

The user first selects a video to be uploaded from the FileUploadcontrol after that s/he selects a category from DropDownList1 (category list). After the user selects a category, I fill the second DropDownList with subcategories.

When I select a file to upload, and select a category from the DropDownList, the page disconnects from the server after postback. If I do the same scenario without selecting a file to be uploaded, I succesfully fill the second combo.

Here is my code :

 <tr>
        <td style="text-align: left;" class="style9" colspan="2">
            <asp:Label ID="Label1" runat="server" Text="Video" Width="80px"></asp:Label>
            <asp:FileUpload ID="FileUploadVideo" runat="server" ViewStateMode="Enabled" />
        </td>
        <td style="text-align: left;" class="style4">
            <asp:Label ID="Label3" runat="server" Text="Category" Width="80px"></asp:Label>
            <br />
            <asp:DropDownList ID="cmbCategory" runat="server" AutoPostBack="True" OnSelectedIndexChanged="cmbCategory_SelectedIndexChanged">
            </asp:DropDownList>
        </td>
        <td style="text-align: right;">
            <asp:Label ID="Label6" runat="server" Text="Subcategory" Width="80px"></asp:Label>
            <br />
            <asp:DropDownList ID="cmbSubcategory" runat="server">
            </asp:DropDownList>
        </td>
    </tr>

Any help would be appreciated.

Josh Darnell
  • 11,304
  • 9
  • 38
  • 66
Ozgur Dogus
  • 911
  • 3
  • 14
  • 38

1 Answers1

2

Since you're uploading video, I imagine this is erroring out due to the file size. The default max file size for ASP.NET applications is 4MB. You can add something like this to the <system.web> section of your web.config to increase that deault:

<system.web>
  <httpRuntime executionTimeout="240" maxRequestLength="20480" />
</system.web>

This allows, for instance, for a 20MB file to be uploaded.

For more information check out this article: Large file uploads in ASP.NET

Josh Darnell
  • 11,304
  • 9
  • 38
  • 66
  • 1
    ok. the files i tried was big. The error was the one u mentioned. Thanks a lot ;) – Ozgur Dogus Apr 11 '12 at 13:00
  • 1
    See also: the behavior in IE is that a "Page Cannot Be Displayed" error appears. http://stackoverflow.com/questions/7853271/internet-explorer-cannot-display-the-webpage/7853399#7853399 – mccrager Apr 11 '12 at 15:19