From: S N on 9 Sep 2008 16:19 Also advise the content type in case the file is an excel file, word document, exe file, zip file etc. Thanks in advance. "Anthony Jones" <AnthonyWJones(a)yadayadayada.com> wrote in message news:e94JHNpEJHA.5104(a)TK2MSFTNGP02.phx.gbl... > "S N" <uandme72(a)yahoo.com> wrote in message > news:%23$Hxh7oEJHA.5448(a)TK2MSFTNGP04.phx.gbl... >> What if we want to use sendfiletoresponse but dont want to force the save >> as dialog, instead just want to see the pdf file within the browser >> window itself. >> is there any change required in the code to achieve this. >> > > If you know its a pdf then change content-type to application/pdf and > remove the attachment; keyword from content-disposition. > > -- > Anthony Jones - MVP ASP/ASP.NET > >
From: Old Pedant on 9 Sep 2008 22:00 "S N" wrote: > Just one clarification > You intended > For i = 1 To oStream.Size / clChunkSize > or > For i = 1 To oStream.Size \ clChunkSize He *intended* the latter. The backslash operator means "integer division" in VBScript (and VB and VB.NET) code. That is, a \ b is equivalent to INT( a / b ) ******************** Also, you don't need to mess with Response.Buffer=False, at all. Just follow each Response.BinaryWrite with Response.Flush Now the buffer will never get more full than one "chunkSize".
From: Anthony Jones on 10 Sep 2008 16:02 "Old Pedant" <OldPedant(a)discussions.microsoft.com> wrote in message news:85265E45-E160-4DE4-A613-E47DF74D5AD7(a)microsoft.com... > > > "S N" wrote: > >> Just one clarification >> You intended >> For i = 1 To oStream.Size / clChunkSize >> or >> For i = 1 To oStream.Size \ clChunkSize > > He *intended* the latter. > > The backslash operator means "integer division" in VBScript (and VB and > VB.NET) code. > > That is, > a \ b > is equivalent to > INT( a / b ) > > ******************** > > Also, you don't need to mess with Response.Buffer=False, at all. > > Just follow each > Response.BinaryWrite > with > Response.Flush > > Now the buffer will never get more full than one "chunkSize". > Yes that would work. However it would mask unintended errors that turning the buffer off right at the top of the code exposes. -- Anthony Jones - MVP ASP/ASP.NET
From: S N on 13 Sep 2008 09:41 "Anthony Jones" <AnthonyWJones(a)yadayadayada.com> wrote in message news:usmtyA4EJHA.1268(a)TK2MSFTNGP05.phx.gbl... > "Old Pedant" <OldPedant(a)discussions.microsoft.com> wrote in message > news:85265E45-E160-4DE4-A613-E47DF74D5AD7(a)microsoft.com... >> >> >> "S N" wrote: >> >>> Just one clarification >>> You intended >>> For i = 1 To oStream.Size / clChunkSize >>> or >>> For i = 1 To oStream.Size \ clChunkSize >> >> He *intended* the latter. >> >> The backslash operator means "integer division" in VBScript (and VB and >> VB.NET) code. >> >> That is, >> a \ b >> is equivalent to >> INT( a / b ) >> >> ******************** >> >> Also, you don't need to mess with Response.Buffer=False, at all. >> >> Just follow each >> Response.BinaryWrite >> with >> Response.Flush >> >> Now the buffer will never get more full than one "chunkSize". >> > > Yes that would work. However it would mask unintended errors that turning > the buffer off right at the top of the code exposes. > > -- > Anthony Jones - MVP ASP/ASP.NET > > what kind of errors would be exposed by turning off the buffer. kindly elaborate.
From: Anthony Jones on 13 Sep 2008 16:14
"S N" <uandme72(a)yahoo.com> wrote in message news:OYWSgZaFJHA.912(a)TK2MSFTNGP02.phx.gbl... > > "Anthony Jones" <AnthonyWJones(a)yadayadayada.com> wrote in message > news:usmtyA4EJHA.1268(a)TK2MSFTNGP05.phx.gbl... >> "Old Pedant" <OldPedant(a)discussions.microsoft.com> wrote in message >> news:85265E45-E160-4DE4-A613-E47DF74D5AD7(a)microsoft.com... >>> >>> >>> "S N" wrote: >>> >>>> Just one clarification >>>> You intended >>>> For i = 1 To oStream.Size / clChunkSize >>>> or >>>> For i = 1 To oStream.Size \ clChunkSize >>> >>> He *intended* the latter. >>> >>> The backslash operator means "integer division" in VBScript (and VB and >>> VB.NET) code. >>> >>> That is, >>> a \ b >>> is equivalent to >>> INT( a / b ) >>> >>> ******************** >>> >>> Also, you don't need to mess with Response.Buffer=False, at all. >>> >>> Just follow each >>> Response.BinaryWrite >>> with >>> Response.Flush >>> >>> Now the buffer will never get more full than one "chunkSize". >>> >> >> Yes that would work. However it would mask unintended errors that >> turning the buffer off right at the top of the code exposes. >> >> > > > > what kind of errors would be exposed by turning off the buffer. kindly > elaborate. > Well the sort of problems you've discovered where you may unintentionaly be placing things in the output buffer that you didn't want present. Example:- <!-- #include /virtual="/someinclude.asp" --> <% Response.ContentType = "application/octet-stream" Do Until .... Response.BinaryWrite SomeStuff Response.Flush Loop %> 'someinclude.asp <!-- Ooops some accidental static content here --> <% 'utility code %> Placing a Response.Buffer at the top of your page would barf immediately on that line alerting you to a problem. It also saves you having to remember to Response.Flush if you have multiple places where you write to the buffer. -- Anthony Jones - MVP ASP/ASP.NET |