Arvixe and Reporting Services Using Report Viewer (Part 6 of 7)

This is the 6th of 7 articles on SSRS. For a brief recap you can find them here:

Part 1 – Arvixe and Reporting Services Intro
Part 2 – Arvixe and Reporting Services Verify
Part 3 – Arvixe and Reporting Services Deploy
Part 4 – Arvixe and Reporting Services Consuming Options
Part 5 – Arvixe and Reporting Services Direct URL

This article is to provide an example of how to use VS2012 Report Viewer against an Arvixe SSRS Server. As I have said before many of the points in these articles can be used regardless of the hosting solution but if you host with Arvixe you should find all of these articles very relevant.

After you have deployed a report you can process and view the report in two ways. Today I want to give you an example of how to use the ReportViewer to display a report in a web page.

Step 1. Launch VS2012 and create a blank web application project. Let’s Call it SSRSArvixeReportViewer (Pretty original).
Step 2. Once you have done that than add a web page and call it ShowReport.aspx. Once you are done it should look something like this. (Figure 1)

SSRSFigure1Figure 1

Step 3. Open the Showreport.aspx and drag the reportviewer control and the script manager control. The need for the reportViewer control should be obvious but the script manager control is used for running the report Asynchorously. When you are done it should look something like this. (Figure 2) This process of adding these controls will also make changes to your web.config. (See Figure 3)

Figure2Figure 2

 Figure3Figure 3

Step 4. You are ready to consume your report from Arvixe SSRS. There are a couple of things to keep in mind. When you are consuming a report you must pass the login and password that Arvixe gave you. This will give your application the necessary credentials to run the report. In order to do this I found this nice little class that you can add to your project that helps in passing these credentials. I actually got it from here. Now that you have this, the rest is just setting the parameters and writing a few lines of code in the code behind of the form. (See Below). To keep with the same account information from the prior articles (You will receive something similar to this when you subscribe to SSRS with Arvixe (Figure 4))

Directfigure1


Imports Microsoft.Reporting.WebForms

Public Class _Default
    Inherits System.Web.UI.Page

    Private Sub _Default_Init(sender As Object, e As EventArgs) Handles Me.Init
        If Not Page.IsPostBack Then
            ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote
            ReportViewer1.ToolBarItemBorderColor = System.Drawing.Color.PowderBlue
            ReportViewer1.ToolBarItemBorderStyle = BorderStyle.Double

            Dim strUserName As String = "angler2be_report"
            Dim strPassword As String = "1Password1"
            Dim strDomain As String = "trout.arvixe.com"

            ReportViewer1.ServerReport.ReportServerCredentials = New ReportCredentials(strUserName, strPassword, strDomain)

            ReportViewer1.ServerReport.ReportServerUrl = New Uri("http://trout.arvixe.com/ReportServer_SQL_service")
            ReportViewer1.ServerReport.ReportPath = "/BestFishingSpot" 'Name of Report

            ReportViewer1.AsyncRendering = True
        End If
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    End Sub
End Class

A few special notes regarding this.

* When the AsyncRendering property is set the False the ReportViewer will render the report as inline HTML. Since the HTML is inline, the rest of the page will be blocked while the report is processed and rendered.

* If you place the above code in the Load Page it will keep calling the report over and over again. You need to place it in the init part of the page and check for postback.

That’s it! If you are going to add parameters just make sure that the parameters are set before rendering the report or you will get an error.

As promised you can download the sample project SSRSArvixeReportViewer.

Looking for quality web hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , , , , , , , | Posted under Programming/Coding | RSS 2.0

Author Spotlight

David Bauernschmidt

David Bauernschmidt

I live in the historical triangle of Virginia where I am married with two daughters. I have spent over 13 years working for a Fortune 500 company in the computer area. I started in VB 6.0 and by the time I ended my employment I was supervising a development team where we built many web applications. When my first daughter was born I wanted to spend more time with her so I left and became a programmer analyst for local government as well as launch my own company. Since then I have grown James River Webs into a profitable web design and application company helping small businesses create a big presence on the internet. As an employee I have created web application used by citizens and other companies. I enjoy fly fishing, and spending time with my family. I also enjoy learning new approaches and development tools when it comes to developing applications.

2 Comments on Arvixe and Reporting Services Using Report Viewer (Part 6 of 7)

  1. Anthony says:

    Have been trying to work this all night. I have a client who is trying to set up SSRS through Arvixe. He has everything working fine but he wanted the ability to run reports without authentication so he has followed your tutorial series and could not get the ReportViewer Control to work.
    I am begging to see the problem he ran into. I first of all set this all up through C#. I am a desktop applications developer and have never developed in ASP.Net before… but this seemed basic enough. When I deployed my page I keep getting a “The request failed with HTTP status 401: Unauthorized.
    ” code. So I dinkered with that for a few hours and still kept pulling up the same. So then I downloaded your VB version added all the corresponding credentials and am still getting the same error even with your script. Now I did look this up and of course came across your other article: “The Request Failed With HTTP Status 401: Unauthorized Using SSRS – See more at: http://blog.arvixe.com/the-request-failed-with-http-status-401-unauthorized-using-ssrs/#sthash.se0CiUdS.dpuf” but this seems completely unrelated in that I do not see how to adjust the code to implement this fix.

    PLEASE HELP!! I desperately need to fix it this morning if possible… Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *


× 4 = 36

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>