On the road again...

The life of a .NET commuter.

March 2008 - Posts

app_offline.htm

This is probably old news, but if you temporarily need to take an ASP.Net Application offline, simply drop a file called app_offline.htm into the root directory of the app. This could be helpful when upgrading a live app.  That way, you don't get the ugly app errors that often crop up.  Like I said, old news to most of you, but still a helpful reminder. 

Posted: Mar 13 2008, 09:53 AM by du8die | with 3 comment(s) |
Filed under: , ,
Render the contents of a ReportViewer control directly to PDF.

Rendering the output of a ReportViewer control (SQL Reporting Services) directly to PDF is fairly easy. It involves simply rendering the Report Viewer output to a byte array, and then pushing it to a MemoryStream object and writing to the Output Stream. Code below:

Dim warnings As Warning() = Nothing

Dim streamids As String() = Nothing

Dim mimeType As String = Nothing

Dim encoding As String = Nothing

Dim extension As String = Nothing

Dim bytes As Byte()

bytes = ReportViewer1.ServerReport.Render("PDF", Nothing, mimeType, encoding, extension, streamids, warnings)

Dim
ms As New System.IO.MemoryStream(bytes)

Response.ContentType = "Application/pdf" 

Response.BinaryWrite(ms.ToArray())

Response.End()

More Posts