My aspx page code reads some custom values from the HTTP headers and then
writes a given pdf to the output stream based upon the header values.
Unforunately, my code causes IE to pop up an Open / Save dialog instead of
invoking the Adobe plugin and displaying the pdf inside of I.E. Here is my
code (file points to a valid pdf and mimetype is set to 'application/pdf')
private void RenderFile(File Info file, string mimeType){
this.Context.Re sponse.ContentT ype = mimeType;
Debug.WriteLine (this.Context.R esponse.Content Type);
this.Context.Re sponse.AddHeade r("Content-Length",
file.Length.ToS tring());
byte[] buffer = new byte[1024];
int bytesRead = -1;
FileStream fs = new FileStream(file .FullName, FileMode.Open,
FileAccess.Read );
Debug.WriteLine (fs.Length);
Stream output = this.Context.Re sponse.OutputSt ream;
int i = 0;
while ( (bytesRead = fs.Read(buffer, 0, buffer.Length)) > 0 ){
output.Write(bu ffer, 0, bytesRead);
}
output.Close();
}
Watched the HTTP traffic through a tunnel and noticed that ASP.NET is
tacking on a content-type of utf-8 on the response (even though my code set
it to application/pdf).
HTTP request
GET /webtier/PcFileRetriever .aspx?queryStri ngParams omitted for brevity
HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword,
*/*
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR
1.1.4322)
Host: localhost:81
Connection: Keep-Alive
Cookie: ASP.NET_Session Id=dqnbdy45x0pl ax344a1drb55
HTTP response
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Wed, 16 Jul 2003 19:41:41 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Cache-Control: private
Content-Type: application/pdf; charset=utf-8
Content-Length: 12850530
Anyone know how to properly stream the pdf file so the IE Adobe browser
plugin displays it instead of prompting the user to save? thanks
scott 0 1495 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mark |
last post by:
Hello,
I am new to PERL and I want to do a simple function (in LINUX):
find all files that have the extension pseudo.pdf and put the file
names in a file;
parse the file and change all file names current filename plus date:
pseudo+date+.pdf
|
by: billby |
last post by:
Hi all,
I am trying to solve a problem on a production server, that unfortunately is
not repeatable on our development server. It is for a bank, and the site is
being hosted by a different company.
Anyway the problem is this. There is a directory where a number of pdfs are
stored. Here is the structure.
bank
|
by: Martin Emanuelsson |
last post by:
Hello,
I have a problem with a small asp-solution that searches for PDF-documents
with
indexing service.
For some files in the search result I get gibberish returned, such as
******************************************************
I$OYDURSURGXFWVSURGXFHGLQ0H[LFR/DERUDWRU\5HSRUW/DERUDWRU\2UGHUHU5HVSRQVLEOH6
WDWXV)HPLQLQH*27-RKDQVVRQ6XVDQQH)LQDO'DWH)LQDO3URMHFW3URMHFW1DPH&RVWSODFH9HU
|
by: Ragnar Heil |
last post by:
Hi,
I want to produce .fo-documents and now I am searching for a fo-processor
which can transform them into secure pdfs. I don´t want to touch every pdf
manually to set security settings like "no printing" or "no content
copying".
regards
Ragnar
|
by: BlueDolphin |
last post by:
Hello all. I'm looking for some opinions on using snapshot files or
..pdf for some reports. We are in the initial stages of creating some
reports in access that will be pulled online through Cold Fusion. In
the past, I have simply created reporting tables with routines that
populated the tables overnight. I then use Cold Fusion to output the
info online as I wanted it to look.
I am in a shop now that wants to use either .pdfs or...
| |
by: Pawan |
last post by:
Hi Guys,
I have this current assignment where I have to develop online forms for
local municipal authorities. I have to use adobe acrobat to create online
forms from PDFs (which I have never done before and have no idea how to do
it). Now these online forms will be shared by 1200 users. VB and ASP will be
used as glueware for the writing/coding. For eg, we will be creating
navigation pages in ASP & linking into adobe. Any resource on this...
|
by: Null |
last post by:
Hello --
I am looking for a way to dynamically generate PDF documents - combining
Crystal Reports and data driven "fields".
For example, I have a template that's essentially a summary document and I
would like to populate certain fields with client names and account data.
Also, I would like to make a "master" PDF that contains all the PDF
summaries in one document -- and use bookmarks if possible.
|
by: Mike Kingscott |
last post by:
Hi there,
I'm writing an app in which a punter buys some PDFs online. After
purchasing said PDFs, they will be given a token (bless them Guids) to
go to a download .ASPX page from which they can download the PDFs.
I'm planning to use Forms Authentication to protect the .ASPX page
which gives them the list of PDFs they can download (driven by the
token, which will be their order number or similar). The page will
also only allow 10...
|
by: praveenkhade |
last post by:
I am working on asp.net ,C#. The pdf files in the grid are displaying properly.
The main prob is that in these pdfs one pdf is the main like an index ,if i open this pdf i can link to rest of other pdfs(No need to open rest of the pdfs one by one).
The index pdf is opening but its not diverting to that link. (Rest of other pdfs contains individual product information and Index pdf contains list of product .I wnt to click on links in Index...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |