Link to home
Start Free TrialLog in
Avatar of JenebyM
JenebyM

asked on

Thread was being aborted

I have implemented the solution as indicated but can't seem to find the code block that is generating the error.

Are you able to check this code and see where this exception is occurring. It could be something quite simple. Its been a long day.

Thanks
sqlr = cmd.ExecuteReader();
                while (sqlr.Read())
                {
                    if (!sqlr.IsDBNull(0) && !sqlr.IsDBNull(1))
                    {
                        bytDocument = (byte[])sqlr["SupportingDocument"];
                        strExt = sqlr.GetString(1).ToLower();
                    }
                    else
                    {
                        //My messages here
                        return;
                    }
                }
            sqlr.close();
strFileName = "test";
Response.Clear();
                             //   Response.ContentType = "application/octet-stream";
                           switch (strExt.ToUpper())
                           {
                               case "PDF":
                                   Response.ContentType = "application/pdf";
                                   break;
                               case "JPG":
                           }
 
                            //Tell browser to save rather than display inline.
                           Response.AppendHeader("Content-Disposition", "attachment; filename=" + strFileName+strExt);
                           Response.AddHeader("Content-Length", myFile.Length.ToString());
                           Response.BinaryWrite(bytDocument);
                           Response.Flush();
                           Response.End();
}
            catch (Exception)
            {
                     //Show processing error
            }
            finally
            {
                cn.Close();
            }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Rahul Goel
Rahul Goel
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JenebyM
JenebyM

ASKER

Ok , Thanks.

This closes the question. Thanks for helping a very tired mind.

Regards