I'm trying to use SSRS reporting with an Asp.net MVC website with local reports.
I tried everything that is mentioned in this post, but I keep getting a hidden div with the following message instead:
The Report Viewer Web Control HTTP Handler has not been registered in the application's web.config file. Add to the system.web/httpHandlers section of the web.config file, or add to the system.webServer/handlers section for Internet Information Services 7 or later.
The handlers are correctly added to the web config and reports will work if I navigate to the aspx page directly (by , but since view engine is not involved I cannot use any of razor helpers, this problem only occurs when I'm using routing.
I have RouteExistingFiles = false and ignored the following routes:
{resource}.axd/{*pathInfo};
{resource}.aspx/{*pathInfo};
{resource}.ascx/{*pathInfo};
and disabled the BlockViewHandler by removing it from the webconfig.
I'm using Microsoft.ReportViewer for visual studio 2012 (ver 11.0.0.0)
Edit
There is this post from Scot Hanselman about using razor views with ASPX master pages, I'm doing the exact reverse, using aspx user control with Razor layout, but this Microsoft report viewer does not work with this approach.
Because of your comments, I've found the reason because it's not working.
I have a User control that uses the report viewer, and a aspx page that uses that user control to show the reports. if I navigate directly to the report like: myhost/Views/Shared/ReportViewer.aspx it works, if I use routing like: myhost/report/myreport it wont work
When you navigate directly to the page, it's rendered by the "traditional" web forms infrasctructure, so all the elements needed by the report viewer (view state, script manager and son on) are available, and the report viewer works fine.
When you navigate using routing, form the comments:
yes creating a route that makes the reportviewer to be handled by an MVC controller which returns a razor view that renders report user control using Html.RenderPartial("ReportControl")
In this case, you're rendering a traditional web form as if it was a razor page. When you do this, all the infrastructure needed by the report viewer control is missing (particularly the view state), and thus it doesn't work.
So, you need to show the report viewer page as a traditional web form. You can open it in a new window/tab by using javascript. If you still want to integrate it in an existing MVC page, the only solution is to use an <iframe> and render the report inside it.
Another solution to integrate it directly in an MVC page would be to render the report using the Reporting Services web service, and sending the output to the browser (for example as a .jpg image or a PDF doc). But, whichever format you choose, it will lack the report viewer interactitvity.
Related
I have a MVC web application that uses the ReportViewer control on a web forms page to view reports and a separate code routine to export the same reports directly to PDF. The export to PDF code works well, but when I try to view the same report in the ReportViewer control using the same path/credentials, I am getting the windows prompt to login.
The export code does not use the ReportViewer server control but instead the Render method the Report class, so I think the problem is likely in there somewhere.
I have successfully deployed this same code on other web servers with success, so I suspect it has something to do with configuration or version of the report viewer control. I tried updating from the version i was using (ReportViewer version 10.0.0.0) to version 12.0.0.0, but the problem remained after the update.
Thanks in advance for any help,
I was able to solve this after figuring out that it had nothing to do with the report viewer control but rather with my routing configuration. The clue was that after entering credentials, I was getting a 404 error. The page that is displaying the report viewer is a web forms page, so then I started looking into issues with running Web forms side-by-side with mvc and came across this link which showed how to setup routes to execute .aspx web forms. After tweaking the route, the report viewer web form page come up and executed just fine.
I have the unusual situation to solve... There is a application page that runs inside SharePoint 2010 with a form to upload some file to a Document Library.
The thing is that this application page needs to be showed on a modal inside my ASPX web app.
I got this running using simplemodal jquery plugin running inside a iframe.
My question is... how can I achieve this functionality considering security questions like a controlled access to this application page? My SharePoint site does not allow anonymous access so I need to figure out how to allow public access only on this page.
I would re-create the page in this asp.net application and then communicate with sharepoint using the client object model or perhaps another approach such a custom webservice (but client model should be ok). I would say that this is the only clean way to achieve your goal.
I have this situation in my SL4 application: We create some User Accounts in the Silverlight APP, now we want to generate printable reports for the generated accounts which we will hand out to the users. The idea is to save the information from the created account to a database, redirect from the Silverlight App to an ASP.NET page passing the ID of the stored account information and display the data in a report viewer control in asp.net from where it can be printed and exported.
Is this possible or am I completely wrong? How can I redirect from silverlight to the asp.net page and how can I pass the ID?
You can use Window.Navigate to do the same. For example,
// Navigate to the web page
System.Windows.Browser.HtmlPage.Window.Navigate(new Uri(”http://www.xyz.com/report.aspx”));
//Open in a separate window
System.Windows.Browser.HtmlPage.Window.Navigate(new Uri(”http://www.xyz.com/report.aspx”), “_blank”);
You can pass the id using the query-string.
See this SO question that discusses other options: redirect to another page from Silverlight
I have a different way of showing reports in a Silverlight application. I make use of the Acrobat Reader plugin to do the displaying for me. It does require a different method depending on whether your application is running inside or outside the browser (I check if the application is running inside the browser and change the means of display accordingly). If running inside the browser, I overlay the application with an IFrame, as I describe in this article: http://www.silverlightshow.net/items/Building-a-Silverlight-Line-Of-Business-Application-Part-6.aspx. Otherwise, I use the WebBrowser control. I have a control which does this all for you in the source code that accompanies my book, which is downloadable from the Apress website here: http://www.apress.com/9781430272076/.
NOTE: I copied this answer from my previous response to a similar question here: Show pdf inside silverlight application. PDF to XAML
I'm building a system which can create forms during runtime. System is written for WinForms and works well for creation of Windows forms and reports. Forms are written to the database as XML.
Now I want to extend that principle to web domain. On Default.aspx for example I plan to put placeholder and write code for creation of web controls.
The question that bugs me is - how can I open such web page from my WinForms appliaction? I need to open it in default browser and transmit ID to it.
The sequence is this - Design the form, save it to database, open a web page with form rendered on it.
Ok so taking the trival example of saving a form to the DB it will get an ID.
You can then have an ASP.Net page that expects to be passed a param on the QS of formid=1
so
http://yoursite/formbuilder.aspx?formid=1
Within your page you can then check if that id is passed in on the querystring and create the form that way.
To open the browser you can do something similar to this
System.Diagnostics.Process.Start("http://<yoursite>/formbuilder.aspx?formid=1");
I am adding functionality to an ASP.Net webforms application and we've decided that new development will be done MVC with a view to move all functionality over eventually.
Obviously, MVC and WebForms play together rather nicely when it comes to accessing an MVC action via a URL. However, I'd like to display the MVC view within an existing tab (telerik) control on a WebForm page. This view will be using js/css file so that will need to be considered also.
Well I'd use jquery/js to load the tab dynamically on page load / select tab. If add a js function to the required handler you can fire an ajaxGet to retrieve the html from your MVC action URL.
If needed I can get some sample code. Are you using jQuery in your ASP.Net app or MSAJAX ??
Cheers
ian