Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

This is the "The page cannot be displayed" error when the file is too large. My problem though seems to be more of a timeout issue.

 

I have set the maxRequestLength="4096" in the web.config, as well as executionTimeout="900". But when I try to upload a file above 900k I still get the above error. Smaller files work fine.

This is on a 640K dsl connection.

I had someone else try to upload a file who had a faster connection (T1) and they were able to upload up to 1.5MB without error.

 

I'm using standard code to upload (see below).

 

What is going on? It's so simple yet I cannot get it to work.

Thanks,

ADAM

 

 

-----------------------------------------------------------------------

 

<html>

<script language="VB" runat="server">

 

Sub File_Upload (Sender as Object, e as EventArgs)

 

 

Dim strFileName as string

strFileName = MyFile.PostedFile.FileName

Dim myFileName as string = System.IO.Path.GetFileName(strFileName)

 

Try

MyFile.PostedFile.SaveAs(server.mappath("\jj\pics\") + myFileName)

FileName.InnerHtml = MyFile.PostedFile.FileName

FileContent.InnerHtml = MyFile.PostedFile.ContentType

FileSize.InnerHtml = MyFile.PostedFile.ContentLength

ThankYouMessage.Visible = true

catch Exp as exception

ERRORMSG.InnerHtml=Exp.Message

ErrorMessage.Visible = true

End Try

 

End Sub

</Script>

 

<body>

 

<form method="Post" enctype="Multipart/Form-Data" runat="Server">

Choose a file to upload:<br>

<input id="MyFile" type="File" runat="Server" size="25">

<p></p>

<input type="Submit" value="Upload" onserverclick="File_Upload" runat="Server">

<P>

 

<asp:panel id="ThankYouMessage" runat="server" Visible="False">

Success.<p>

File Name: <span id="FileName" runat="Server"/><br>

File Content: <span id="FileContent" runat="Server"/><br>

File Size: <span id="FileSize" runat="Server"/>bytes<br>

</asp:panel>

 

<asp:panel id="ErrorMessage" runat="server" Visible="False">

Your File was not sucessfull.<br>

<span id="ERRORMSG" runat="Server"/>

</asp:panel>

 

</form>

</body>

</html>

Posted

Maybe this helps:

 

Change the "machine.config" in the framework's directory (mine is under (\Windows\Microsoft.net\.........)

 

<httpRuntime

executionTimeout="90"

maxRequestLength="4096"

useFullyQualifiedRedirectUrl="false"

minFreeThreads="8"

minLocalRequestFreeThreads="4"

appRequestQueueLimit="100"

enableVersionHeader="true"

/>

 

Change the values you need...

 

Regards

Posted

Unfortunately I do not have control over the machine.config. This is on a web server belonging to my web host.

Besides, the web.config is *supposed* to override settings in machine.config.

 

Thanks,

ADAM

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...