How to download a file using c# , db Hong Kong SAR
  • 13 years ago


       I want to downloadfile whose path is stored in the sql server db...

       I have created sp to retrieve the path...

       then in the code i used .......

                    Response.ContentType = "Text/txt";
                    Response.TransmitFile(mediafullname);//mediafullname is the path of the file..

    but this code will download some other file......Help me in this Please..I dont know where m doing wrong...


    Thanks in Advance... 

  • 13 years ago


     You could actually do is open a new window and then  get the path from database at server side and redirect the page to the file location.After that you  will get the standard windows Open,Save dialog box to dowload a file.

    Try that and let me know it it works.



  • 13 years ago


         Thanks..But my code itself working now....Sorry a small error so only apart from that no probs in that code.....Anyhow thanks....

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“PHP is a minor evil perpetrated and created by incompetent amateurs, whereas Perl is a great and insidious evil perpetrated by skilled but perverted professionals.” - Jon Ribbens