pdf and rar files not uploading but images do
<p>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</p>

<blockquote>
  <p>the connection to localhost has been interupted</p>
</blockquote>

<p>This is my code:</p>

<pre><code>&lt;div id="center"&gt;
       &lt;asp:FileUpload ID="FileUpload1" runat="server" /&gt;
       &lt;br /&gt;
       &lt;asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /&gt;
       &lt;asp:Label ID="Label1" runat="server" Text="Label"&gt;&lt;/asp:Label&gt;
&lt;/div&gt;


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";
            }
        }   
    }
</code></pre>

<p>What is the problem? Why can't I upload other file types?</p>
