is there a difference in the lines of comments

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
 
G

Göran Andersson

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.
 
R

rodchar

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top