0

Hi,

In our project, I wrote the below code to upload any file of size less than equal to 2MB, in my local XP system working fine, when i deployed to client server having config windows server 2003, i got request time error when size is more than nearly more than 1MB.

My code is:

FileStream objFileStream;
BinaryReader objBinaryReader;

Byte[] byAttach;

string sFileName = "TempAttach\\" + FileUpload1.FileName.ToString();

FileUpload1.PostedFile.SaveAs(HttpContext.Current.Server.MapPath(sFileName));

objFileStream = new FileStream(HttpContext.Current.Server.MapPath(sFileName), FileMode.Open, FileAccess.Read);


objBinaryReader = new BinaryReader(objFileStream);
byAttach = objBinaryReader.ReadBytes((Int32)objFileStream.Length);

objBinaryReader.Close();
objFileStream.Close();

FileInfo objFileInfo = new FileInfo(HttpContext.Current.Server.MapPath(sFileName));

if (objFileInfo.Exists)
{
File.Delete(HttpContext.Current.Server.MapPath(sFileName));
}

Web.config:
<httpRuntime maxRequestLength="102400" executionTimeout="10000"/>
<sessionState timeout="110"/>

Eventhough I set the executionTimeout and sessction timeout more than 1 hour, during file upload of more than 1MB the web page only processing for less than 3 minutes after that it displaying page cannot process error message, when the file size less 1MB it working fine.

Advise me that any other settings I need to carry out.

Please its urgent.

Thanks.

4
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by crishlay
0

Check your IIS settings for your website. A lot of them are the same as the web.config ones but sometimes will override them.

0

Hi,

In our project, I wrote the below code to upload any file of size less than equal to 2MB, in my local XP system working fine, when i deployed to client server having config windows server 2003, i got request time error when size is more than nearly more than 1MB.

My code is:

FileStream objFileStream;
BinaryReader objBinaryReader;

Byte[] byAttach;

string sFileName = "TempAttach\\" + FileUpload1.FileName.ToString();

FileUpload1.PostedFile.SaveAs(HttpContext.Current.Server.MapPath(sFileName));

objFileStream = new FileStream(HttpContext.Current.Server.MapPath(sFileName), FileMode.Open, FileAccess.Read);


objBinaryReader = new BinaryReader(objFileStream);
byAttach = objBinaryReader.ReadBytes((Int32)objFileStream.Length);

objBinaryReader.Close();
objFileStream.Close();

FileInfo objFileInfo = new FileInfo(HttpContext.Current.Server.MapPath(sFileName));

if (objFileInfo.Exists)
{
File.Delete(HttpContext.Current.Server.MapPath(sFileName));
}

Web.config:
<httpRuntime maxRequestLength="102400" executionTimeout="10000"/>
<sessionState timeout="110"/>

Eventhough I set the executionTimeout and sessction timeout more than 1 hour, during file upload of more than 1MB the web page only processing for less than 3 minutes after that it displaying page cannot process error message, when the file size less 1MB it working fine.

Advise me that any other settings I need to carry out.

Please its urgent.

Thanks.

This is usefully quetion for us

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.