ReportViewer prompt for credentials when using viewer control - asp.net

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.

Related

SSRS report viewer not working with asp.net mvc routing

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.

File not found error on User control on production

I made 2 usercontrols for sharepoint 2007 site. Everything is working fine on test server. I deployed it on production but only 1 got deployed and placed properly. The second user control is added n deployed to web part galleries but gives File not found error when i add it on web part page. I deployed it using WSP. yet it gives this error. I checked logs it did not show anything. I have no idea what to do. please help. If more details are required I am ready to share but please help me
![Error which I get] http://i.stack.imgur.com/jOjwb.jpg
WSP will deploy according to your requirements. You could build your WSPs automatically using WSPBuilder http://wspbuilder.codeplex.com/
You should not deploy the user controls to web part galleries. The user controls should be deployed to CONTROLTEMPLATES so modify your WSP accordingly.
You could use the SmartPart to show any controls you developed.
http://smartpart.codeplex.com/

Silverlight redirects to ASP.NET Page with ReportViewer Control

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

Contents of a code-behind file is rendered instead of a control

I have a user control which is being added to a page dynamically. It works fine on my computer whether a site is running on an integrated Visual Studio server or deployed to IIS.
But when the site is deployed to a production server, I see the contents of a user control's code-behind file instead of a control.
Have you any ideas what can cause this?
Thank you.
EDIT: The site is running on IIS 6 and here is the code I am using to add the control to a page
`this.Controls.Clear();
this.Controls.Add(LoadControl("MyUserControl.ascx"));`
Yikes. That should never happen. Are other ASP.NET pages working correctly? Are you sure ASP.NET is properly registered on the server? I think you'll need to give us some more information... what version of IIS are you running, and post the code where you dynamically add the user control.

What can cause ASPNET AJAX page to revert to normal ASPX mode ? / UpdatePanel broken

I am using VS 2008 with a very simple UpdatePanel scenario.
But i cannot get UpdatePanel to work and cant seem to find out why
I have in fact reverted to a very simple example to validate it is not my code:
http://ajax.net-tutorials.com/controls/updatepanel-control/
In this example I click on either button and both text links update.
I dont get any errors, the page just behaves like a normal ASPX page.
What things do i need to check. I've been googling this for an hour and not found what I need.
Edit: Works in Visual Studio web server but not in IIS
If it's working locally, but not when deployed to a remote server, that usually indicates that you're using ASP.NET 2.0 and the ASP.NET AJAX extensions aren't installed on the remote server.
If it's a server you have administrative control over, you can download the installer here: http://www.microsoft.com/downloads/details.aspx?FamilyID=ca9d90fa-e8c9-42e3-aa19-08e2c027f5d6&displaylang=en
If it's a web host, tell them to get their act together.
Another option would be to check your web.config. You could for example create an new Ajax enabled ASP.NET website from Visual Studio. This will generate a correct web.config. Copy over all non-ajax sections from your existing web.config and you're set. This worked for me.
-Edoode

Resources