Click here to Skip to main content
15,913,610 members
Home / Discussions / C#
   

C#

 
AnswerRe: Save a 4bpp Bitmap Pin
Luc Pattyn1-Feb-07 2:07
sitebuilderLuc Pattyn1-Feb-07 2:07 
Questionhow to set password on my Sql2005 express database ? Pin
hdv2121-Feb-07 0:04
hdv2121-Feb-07 0:04 
QuestionPlz help me on programmatically set NTFS file system folder permissions Pin
Sanjib Raj31-Jan-07 23:49
Sanjib Raj31-Jan-07 23:49 
AnswerRe: Plz help me on programmatically set NTFS file system folder permissions Pin
bobsugar2221-Feb-07 0:46
bobsugar2221-Feb-07 0:46 
QuestionInvoking exe file through asp.net Pin
kalyan_241631-Jan-07 23:06
kalyan_241631-Jan-07 23:06 
AnswerRe: Invoking exe file through asp.net Pin
Pete O'Hanlon31-Jan-07 23:11
mvePete O'Hanlon31-Jan-07 23:11 
GeneralRe: Invoking exe file through asp.net Pin
kalyan_241631-Jan-07 23:24
kalyan_241631-Jan-07 23:24 
GeneralRe: Invoking exe file through asp.net Pin
Pete O'Hanlon1-Feb-07 0:22
mvePete O'Hanlon1-Feb-07 0:22 
That is not the way to download a file from the server. If it was, then this would be a major security flaw and a gaping hole through which exploit attacks could occur. What you need to do is to write the file to the response stream and set the content type appropriately. Note that you cannot directly execute the program. The user has to do this.

To download the file:

private void WriteFile(string fileName)
{
  try
  {
    Response.ContentType = "APPLICATION/OCTET-STREAM";
    // Attach the file name as the content disposition.
    string header = string.Format("Attachment; Filename = \"{0}\", 
      Path.GetFilename(fileName));
    Response.AppendHeader("Content-Disposition", header);
    FileInfo download = new FileInfo(fileName);
    Response.Flush();
    Response.WriteFile(download.FullName);
  }
  catch (Exception ex)
  {
    //Report out any errors.
  }
}



the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer

Deja View - the feeling that you've seen this post before.

AnswerRe: Invoking exe file through asp.net Pin
Colin Angus Mackay31-Jan-07 23:11
Colin Angus Mackay31-Jan-07 23:11 
AnswerRe: Invoking exe file through asp.net Pin
led mike1-Feb-07 4:40
led mike1-Feb-07 4:40 
GeneralRe: Invoking exe file through asp.net Pin
kalyan_241631-Jan-07 23:25
kalyan_241631-Jan-07 23:25 
QuestionErrors with book example program Pin
Lurker0031-Jan-07 23:02
Lurker0031-Jan-07 23:02 
AnswerRe: Errors with book example program Pin
Colin Angus Mackay31-Jan-07 23:10
Colin Angus Mackay31-Jan-07 23:10 
GeneralRe: Errors with book example program Pin
Lurker0031-Jan-07 23:19
Lurker0031-Jan-07 23:19 
AnswerRe: Errors with book example program Pin
Stefan Troschuetz31-Jan-07 23:18
Stefan Troschuetz31-Jan-07 23:18 
GeneralRe: Errors with book example program Pin
Lurker0031-Jan-07 23:36
Lurker0031-Jan-07 23:36 
GeneralRe: Errors with book example program Pin
Russell Jones1-Feb-07 0:23
Russell Jones1-Feb-07 0:23 
AnswerRe: Errors with book example program Pin
bobsugar2221-Feb-07 2:14
bobsugar2221-Feb-07 2:14 
GeneralRe: Errors with book example program Pin
Lurker001-Feb-07 17:31
Lurker001-Feb-07 17:31 
Questionhow to assign a null value to an int Pin
quiteSmart31-Jan-07 22:59
quiteSmart31-Jan-07 22:59 
AnswerRe: how to assign a null value to an int Pin
Colin Angus Mackay31-Jan-07 23:06
Colin Angus Mackay31-Jan-07 23:06 
AnswerRe: how to assign a null value to an int Pin
Parwej Ahamad1-Feb-07 1:14
professionalParwej Ahamad1-Feb-07 1:14 
QuestionRemove groupbox borders Pin
Ankit Aneja31-Jan-07 22:45
Ankit Aneja31-Jan-07 22:45 
AnswerRe: Remove groupbox borders Pin
Colin Angus Mackay31-Jan-07 23:04
Colin Angus Mackay31-Jan-07 23:04 
AnswerRe: Remove groupbox borders Pin
krieg381-Feb-07 0:17
krieg381-Feb-07 0:17 

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.