Click here to Skip to main content
15,912,082 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Class Library Pin
saini arun18-Dec-09 21:23
saini arun18-Dec-09 21:23 
AnswerRe: [Message Deleted] Pin
sashidhar18-Dec-09 22:45
sashidhar18-Dec-09 22:45 
QuestionDifferent colors of text in textbox [modified] Pin
Dot-Net-Dev18-Dec-09 20:29
Dot-Net-Dev18-Dec-09 20:29 
AnswerRe: Different colors of text in textbox Pin
saini arun18-Dec-09 21:17
saini arun18-Dec-09 21:17 
AnswerRe: Different colors of text in textbox Pin
John Bracey18-Dec-09 22:12
John Bracey18-Dec-09 22:12 
GeneralRe: Different colors of text in textbox Pin
Dot-Net-Dev18-Dec-09 23:17
Dot-Net-Dev18-Dec-09 23:17 
GeneralRe: Different colors of text in textbox Pin
John Bracey19-Dec-09 2:41
John Bracey19-Dec-09 2:41 
QuestionDownload PDF from MY SQL database in asp.net Pin
Imran Khan Pathan18-Dec-09 19:53
Imran Khan Pathan18-Dec-09 19:53 
Hey.
I have one table in MySql Database.
I have two field.
documentBinary LongBlob
documentContentType varchar


My code to download file.


byte[] data = (byte[])Dt.Rows[0]["documentBinary"];
                   // encoding.GetBytes(Dt.Rows[0]["documentBinary"].ToString());// (byte[])Dt.Rows[0]["documentBinary"].ToString();

                System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
                response.ClearHeaders();
                response.ClearContent();
                response.Clear();
                //response.AddHeader("Content-Type", Dt.Rows[0]["documentContentType"].ToString());
                response.ContentType = Dt.Rows[0]["documentContentType"].ToString();
                response.AppendHeader("Content-Disposition",
                    "attachment; filename=" + Dt.Rows[0]["titel"].ToString() + ".pdf; size=" + data.Length.ToString());

                response.BinaryWrite(data);
                response.Flush();
                response.End();


When I download file,File is downloaded successfully but not open in pdf format.

Please look at my code and tell me where I am going wrong.

Thanks
Imrankhan

please don't forget to vote on the post that helped you.

AnswerRe: Download PDF from MY SQL database in asp.net Pin
Sathesh Sakthivel18-Dec-09 19:56
Sathesh Sakthivel18-Dec-09 19:56 
GeneralRe: Download PDF from MY SQL database in asp.net Pin
Imran Khan Pathan18-Dec-09 20:01
Imran Khan Pathan18-Dec-09 20:01 
GeneralRe: Download PDF from MY SQL database in asp.net Pin
Sathesh Sakthivel18-Dec-09 20:17
Sathesh Sakthivel18-Dec-09 20:17 
GeneralRe: Download PDF from MY SQL database in asp.net Pin
Imran Khan Pathan18-Dec-09 20:36
Imran Khan Pathan18-Dec-09 20:36 
QuestionAdding items to dropdownlist from javascript, getting items from code behind... Pin
Jacob Dixon18-Dec-09 7:19
Jacob Dixon18-Dec-09 7:19 
AnswerRe: Adding items to dropdownlist from javascript, getting items from code behind... Pin
Brij18-Dec-09 8:03
mentorBrij18-Dec-09 8:03 
GeneralRe: Adding items to dropdownlist from javascript, getting items from code behind... Pin
Jacob Dixon18-Dec-09 8:28
Jacob Dixon18-Dec-09 8:28 
Questionwizard Control! Pin
srikant.200918-Dec-09 4:35
srikant.200918-Dec-09 4:35 
AnswerRe: wizard Control! Pin
Brij18-Dec-09 5:58
mentorBrij18-Dec-09 5:58 
GeneralRe: wizard Control! Pin
sashidhar18-Dec-09 17:51
sashidhar18-Dec-09 17:51 
AnswerRe: wizard Control! Pin
sashidhar18-Dec-09 17:54
sashidhar18-Dec-09 17:54 
QuestionA question about web-design tools for ASP.NET Pin
James Shao18-Dec-09 2:52
James Shao18-Dec-09 2:52 
AnswerRe: A question about web-design tools for ASP.NET Pin
Ashfield18-Dec-09 9:03
Ashfield18-Dec-09 9:03 
Questionhow to access c# dll from javascript? Pin
iamdking18-Dec-09 2:49
iamdking18-Dec-09 2:49 
AnswerRe: how to access c# dll from javascript? Pin
Abhijit Jana18-Dec-09 3:35
professionalAbhijit Jana18-Dec-09 3:35 
AnswerRe: how to access c# dll from javascript? Pin
Ennis Ray Lynch, Jr.18-Dec-09 3:56
Ennis Ray Lynch, Jr.18-Dec-09 3:56 
AnswerRe: how to access c# dll from javascript? Pin
Abhishek Sur18-Dec-09 4:19
professionalAbhishek Sur18-Dec-09 4:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.