Server Error in '/' Application.

Specified argument was out of the range of valid values.
Parameter name: offset

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: offset

Source Error:


Line 127:       context.Response.ContentType = "image/png";
Line 128:       context.Response.AddHeader("Content-Disposition", "attachment; filename=" + stdid + ".png");
Line 129:       context.Response.BinaryWrite(downloadFile(ConfigurationManager.AppSettings["ftpserver"]+ "/Thumbnail/", ReqPath(orgs, stdid), ConfigurationManager.AppSettings["ftpuser"], ConfigurationManager.AppSettings["ftppass"]));
Line 130:       context.Response.End();
Line 131:        

Source File: c:\inetpub\vhosts\standardsmanager.ir\httpdocs\preview.ashx    Line: 129

Stack Trace:


[ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: offset]
   System.Web.HttpResponseStream.Write(Byte[] buffer, Int32 offset, Int32 count) +11405302
   System.Web.HttpResponse.BinaryWrite(Byte[] buffer) +38
   preview.ProcessRequest(HttpContext context) in c:\inetpub\vhosts\standardsmanager.ir\httpdocs\preview.ashx:129
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +599
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171


Version Information: Microsoft .NET Framework Version:2.0.50727.9061; ASP.NET Version:2.0.50727.9062