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.

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.