Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8656547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:18:07+00:00 2026-06-12T15:18:07+00:00

I have been playing around with asp.net webforms controls to learn how to use

  • 0

I have been playing around with asp.net webforms controls to learn how to use them better and I seem to have gotten myself in some trouble with the fileupload control. I noticed that when I upload img’s the code I wrote works but when I try to upload a PDF or a RAR file I get an error saying that

the connection to localhost has been interupted

This is my code:

<div id="center">
       <asp:FileUpload ID="FileUpload1" runat="server" />
       <br />
       <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
       <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>


protected void Button1_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile) {
            try
            {
                string filename = FileUpload1.FileName;
                FileUpload1.SaveAs(Server.MapPath("~/Files/") + filename);
                Label1.Text = "File has been uploaded";
            }
            catch (Exception ex) {
                Label1.Text = "The file could not be uploaded";
            }
        }   
    }

What is the problem? Why can’t I upload other file types?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T15:18:08+00:00Added an answer on June 12, 2026 at 3:18 pm

    When you try uploading files that is more than the default max size (ie. 4MB) then you may end up in page reset or interruption. You can set the max size in config file.

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

    Fileupload control discussed well here.
    http://weblogs.asp.net/jgalloway/archive/2008/01/08/large-file-uploads-in-asp-net.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been playing around with asp.net MVC3 a bit and have been struggling to
I have been playing around with the XamlAsyncController , which is based on ASP.NET
I'm learning ASP.net and I've been playing around with themes and master pages. I
I have been playing around with webkit.net in a c# win forms project, and
I've been playing around with using MySql as the membership provider for asp.net mvc
I have been playing around with this problem since yesterday. I can't seem to
I've been playing around with ASP.NET MVC with a site containing a Master Page.
Have been playing around with linq but there is one thing I cant seem
I have been playing around with Google Apps Script today and I am trying
I have been playing around a bit with a fairly simple, home-made search engine,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.