is there a difference in the lines of comments

  • Thread starter Thread starter rodchar
  • Start date Start date
R

rodchar

hey all,

is the commented lines essentially the same as the ones not commented?


context.Response.Clear();
context.Response.ClearHeaders();
context.Response.ClearContent();
context.Response.ContentType = @"application/pdf";
//context.Response.AddHeader("content-disposition",
String.Format("inline; filename={0}.pdf", adNumber));
context.Response.AddHeader("content-disposition",
String.Format("attachment; filename={0}.pdf", adNumber));
context.Response.WriteFile(path);
//byte[] image = new byte[fileInfo.Length];
//using (BinaryReader reader = new BinaryReader(new
FileStream(path, FileMode.Open, FileAccess.Read)))
//{
// image = reader.ReadBytes((int)fileInfo.Length);
//}

//context.Response.BinaryWrite(image);
//context.Response.Flush();
//context.Response.Close();
//context.Response.End();

thanks,
rodchar
 
rodchar said:
hey all,

is the commented lines essentially the same as the ones not commented?


context.Response.Clear();
context.Response.ClearHeaders();
context.Response.ClearContent();
context.Response.ContentType = @"application/pdf";
//context.Response.AddHeader("content-disposition",
String.Format("inline; filename={0}.pdf", adNumber));
context.Response.AddHeader("content-disposition",
String.Format("attachment; filename={0}.pdf", adNumber));
context.Response.WriteFile(path);
//byte[] image = new byte[fileInfo.Length];
//using (BinaryReader reader = new BinaryReader(new
FileStream(path, FileMode.Open, FileAccess.Read)))
//{
// image = reader.ReadBytes((int)fileInfo.Length);
//}

//context.Response.BinaryWrite(image);
//context.Response.Flush();
//context.Response.Close();
//context.Response.End();

thanks,
rodchar

Yes.

There is some slight difference between inline and attachment that you
might want to read up on, but they basically do the same thing.

The WriteFile method uses a little less resources, as it doesn't read
the entire file into memory before writing it to the response stream.
 
thanks for the help,
rod.

Göran Andersson said:
rodchar said:
hey all,

is the commented lines essentially the same as the ones not commented?


context.Response.Clear();
context.Response.ClearHeaders();
context.Response.ClearContent();
context.Response.ContentType = @"application/pdf";
//context.Response.AddHeader("content-disposition",
String.Format("inline; filename={0}.pdf", adNumber));
context.Response.AddHeader("content-disposition",
String.Format("attachment; filename={0}.pdf", adNumber));
context.Response.WriteFile(path);
//byte[] image = new byte[fileInfo.Length];
//using (BinaryReader reader = new BinaryReader(new
FileStream(path, FileMode.Open, FileAccess.Read)))
//{
// image = reader.ReadBytes((int)fileInfo.Length);
//}

//context.Response.BinaryWrite(image);
//context.Response.Flush();
//context.Response.Close();
//context.Response.End();

thanks,
rodchar

Yes.

There is some slight difference between inline and attachment that you
might want to read up on, but they basically do the same thing.

The WriteFile method uses a little less resources, as it doesn't read
the entire file into memory before writing it to the response stream.
 
Back
Top