From: Dan on

"Dean g" <big_deanus(a)hotmail.com> wrote in message
news:eREIy9n9KHA.420(a)TK2MSFTNGP02.phx.gbl...
> I already check the ext bwig, the problem is they are not necessarily
> genuine pdf's. I've been searching for mime
> sniffing code like u suggested Dan, but so far can only find
> resources for .net

Just set it to application/octet-stream as Bwig suggested, then the browser
can deal with as it sees fit.

Trying to roll your own MIME sniffing code in ASP is going to be a mess -
without a COM component that you can program against to do it for you it's
not worth even starting. The MIME sniffing I was referring to is already in
IE7 and IE8, they will attempt to determine the appropriate application to
open a file that is downloaded.

--
Dan

From: Bwig Zomberi on
Dean g wrote:
> I already check the ext bwig, the problem is they are not necessarily
> genuine pdf's. I've been searching for mime
> sniffing code like u suggested Dan, but so far can only find
> resources for .net


That will be very expensive in terms of server resources. It will not be
scalable.


--
Bwig Zomberi
From: Dean g on
Damn, 2 out of 3 problems solved is still good.

Thanks for the help guys, i just wish i knew why half the pdf
files display garbage on the screen even though they are
genuine pdf's. i guess thats a question for another group
though.

regards,
Dean



*** Sent via Developersdex http://www.developersdex.com ***
From: Bwig Zomberi on
Dean g wrote:
> Damn, 2 out of 3 problems solved is still good.
>
> Thanks for the help guys, i just wish i knew why half the pdf
> files display garbage on the screen even though they are
> genuine pdf's. i guess thats a question for another group
> though.
>

I had this problem with Opera. In a newer version, it got solved.

Just ensure that you set the content type properly on the server-side
and you are not writing anything other than what is in the PDF to the
browser. To be sure that the entire ASP code is between one set of <%
and %>. Do not use nested code. Do not write any HTML or set any cookies.

On the client side, ensure that Adobe Reader is installed properly and
plugins are available for all browsers.

If the problems persist, then it is problem with the PDFs. You could go
to alt.txt.pdf. However, you will need to host the PDF and provide a
link so they can check it out.


--
Bwig Zomberi
From: Dan on

"Bwig Zomberi" <zomberiMAPSONNOSPAM(a)gmail.com> wrote in message
news:hu5ein$4qs$1(a)speranza.aioe.org...
> Dean g wrote:
>> Damn, 2 out of 3 problems solved is still good.
>>
>> Thanks for the help guys, i just wish i knew why half the pdf
>> files display garbage on the screen even though they are
>> genuine pdf's. i guess thats a question for another group
>> though.
>>
>
> I had this problem with Opera. In a newer version, it got solved.
>
> Just ensure that you set the content type properly on the server-side and
> you are not writing anything other than what is in the PDF to the browser.
> To be sure that the entire ASP code is between one set of <% and %>. Do
> not use nested code. Do not write any HTML or set any cookies.
>
> On the client side, ensure that Adobe Reader is installed properly and
> plugins are available for all browsers.
>
> If the problems persist, then it is problem with the PDFs. You could go to
> alt.txt.pdf. However, you will need to host the PDF and provide a link so
> they can check it out.
>
>

The other thing you can do is use Response.Buffer = true, and then prior to
sending the headers clear the buffer first just in case there are any CR/LF
characters from inline ASP above that piece of code. Or just make sure you
always put inline ASP code fully inline, eg.

<%
blah blah
%>
<%
more blah
write headers
write binary data
%>


will actually put a single CR/LF combination before the data, because there
is a CRLF outside of the ASP tags. The same can be written as


<%
blah blah
%><%
more blah
write headers
write binary data
%>

and not insert the CR/LF.

It's also worth checking this wherever you send out a DOCTYPE headers in
normal HTML, if the DOCTYPE isn't on the first line of the output then some
browsers will ignore it.

--
Dan