Server Error in '/' Application.

Invalid attempt to read when no data is present.

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.InvalidOperationException: Invalid attempt to read when no data is present.

Source Error:


Line 63:             // Zápis dat do výstupu.
Line 64:             context.Response.Clear();
Line 65:             context.Response.ContentType = reader["ImageMimeType"].ToString();
Line 66:             context.Response.BinaryWrite((byte[])reader["ImageData"]);
Line 67:         }

Source File: e:\Web\sites\dev0000039561\wwwroot\Handlers\GetPhotoItemImage.ashx    Line: 65

Stack Trace:


[InvalidOperationException: Invalid attempt to read when no data is present.]
   System.Data.SqlClient.SqlDataReader.GetValue(Int32 i) +118
   System.Data.SqlClient.SqlDataReader.get_Item(String name) +27
   GetPhotoItemImage.CreateImage(HttpContext context, String guid) in e:\Web\sites\dev0000039561\wwwroot\Handlers\GetPhotoItemImage.ashx:65
   GetPhotoItemImage.ProcessRequest(HttpContext context) in e:\Web\sites\dev0000039561\wwwroot\Handlers\GetPhotoItemImage.ashx:22
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75


Version Information: Microsoft .NET Framework Version:2.0.50727.8974; ASP.NET Version:2.0.50727.8975