By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,365 Members | 3,180 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,365 IT Pros & Developers. It's quick & easy.

asp.net app calling Reporting Services cannot open file

P: n/a
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

Oct 18 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
What control are you using to display the Report? Are you using the SQL
Reporting Services Report Viewer control?

--
Ameet Phadnis
Sr. Technical Consultant
e Tek Global Inc.
ASP Alliance Author Page: http://aspalliance.com/author.aspx?uId=44260
"kbutterly" wrote:
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

Oct 18 '06 #2

P: n/a
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
Ameet Phadnis (e Tek Global Inc.) wrote:
What control are you using to display the Report? Are you using the SQL
Reporting Services Report Viewer control?

--
Ameet Phadnis
Sr. Technical Consultant
e Tek Global Inc.
ASP Alliance Author Page: http://aspalliance.com/author.aspx?uId=44260
"kbutterly" wrote:
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
Oct 19 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.