asp.net app calling Reporting Services cannot open file

K

kbutterly

Good afternoon,

I have what appears to be a caching issue, but i'm a bit of a newbie at
http headers so it may be something else.

I have a small asp.net 2.0 application that is called to serve up some
SQL Reporting Services reports. The asp pages are running under SSL as
are the pages that call the asp app.

The asp app runs correctly, but the reports cannot be opened or saved.
I get a "The page cannot be displayed" error.

I am thinking that this is due to caching, as detailed in this MS KB
article: http://support.microsoft.com/kb/316431

I have
Response.ClearHeaders()
and then

Response.AppendHeader("Cache-control",
"public,max-age=1")
Response.ContentType = strContentType
Response.BinaryWrite(bytResult)
Response.Flush()
Response.Close()

where strContentType is defined as "application/octet-stream" and
bytResult is the Byte result of calling the render method.

I have tried using logic to use application/vnd.ms-excel or
application/pdf when applicable instead of application/octet-stream,
but that doesn't help. I

The code originally had
'Response.AppendHeader("Content-Disposition",
"attachment;filename=" + strAttachName) which was to force a download,
but we really don't want the users to save the reports; we would prefer
to have them just view them. As I understand things,
Content-Disposition is used to force the file download box, which I
don't want. I just want the files to open. Do I need to use something
in place of
'Response.AppendHeader("Content-Disposition",
"attachment;filename=" + strAttachName)
when I don't want a file download.

According to the KB article, I need to get rid of the Pragma:no-cache
that is coming across in the response header, but since no-cache is the
only value possible for pragma, I don't know how to do that. I tried
adding Response.AppendHeader("Pragma","") but that didn't work.

Here is the Response Header:

HTTP/1.1 200 OK
Connection: close
Date: Wed, 18 Oct 2006 17:22:27 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Expires: 0
Pragma: no-cache
Cache-control: no-cache,max-age=0,must-revalidate
X-AspNet-Version: 2.0.50727
Cache-Control: public,max-age=1
Content-Type: application/octet-stream

I believe that my ":Cache-Control: public,max-age=1" is overriding both
the "Cache-control: no-cache,max-age=0,must-revalidate" and the
"Expires=0", but I can't get rid of Pragma: no-cache

Any ideas, references, resources, sample code or encouraging words
would be greatly appreciated.

Thanks,
Kathryn
 
G

Guest

What control are you using to display the Report? Are you using the SQL
Reporting Services Report Viewer control?
 
K

kbutterly

Ameet,

Thanks for the reply! No we are not useing the Report View control.

The asp app functions as follows: the aspx page receives a GUID as a
URL parameter. In the page_Load event, it then passes the GUID into a
stored procedure that returns the parameters for the report.

The report is then loaded using the LoadReport method, then the
parameters are set using the SetExecutionParameters method.

The Render method is then called and then the follow code is called:

Response.AppendHeader("Cache-control",
"public,max-age=1")
Response.ContentType = strContentType
Response.BinaryWrite(bytResult)
Response.Flush()
Response.Close()


I am the third developer to work on this and I am pretty much an asp
newbie. Any ideas would be greatly appreciated.

Thanks,
Kathryn
 

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

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top