Can one use Reportviewer Control in ASP.net Core - asp.net-core

I want to make use of the Reporting Services ReportViewer control in an ASP.NET Core MVC project.
The solution as proposed in other answers it to add a webform to the project.
However since ASP.NET Core doesn't support webforms I cannot add the control to a webform.
Is there any other workaround that might possibly assist me in using the ReportViewer control in an ASP.NET Core Web application?

Update 2019
I have ReportViewer working on ASP.NET Core on Windows, and most features (not PDF and Images/PowerPoint) also work on ASP.NET Core on Linux.
There's still some bugs to weed out, though.
You can learn more about it in this github issue.
I can't release it publicly, because ReportViewer has a rather constricting license...
It is based on the AspNetCore.Reporting nuget by amh1979.
You might try the wrapper nuget around ReportExecution.asmx, also by amh1979, this has no licensing issues, but it's no real ReportViewer.
Original post:
No, you can't.
Microsoft is only just evaluating creating a .NET Core ReportViewer control.
Which means there isn't any at present (05/2017).
There also isn't any ReportViewer "control" for ASP.NET MVC.
There is only alanjuden's wrapper around MS-ReportServer's ReportExecution.asmx.
But that isn't the same. That will still require Windows Authentication on the report server (along with user-must-be-member-of-specific-ad-group), and a SSRS server running on Windows.
If you anyway have an SSRS-ReportServer on Windows, you're much better of embedding SSRS ReportViewer.aspx in an iframe. You might want to add forms-authentication to your reportserver. Also, if it needs to be cross-platform (=cross-browser = non-IE), you need SSRS >= 2016 (cross-browser not available in SSRS 2005/2008R1/2008R2/2012/2014).
If you're on Windows and don't want (your customer) to have to install a specific version of SSRS (which means you have to license a MS-SQL-Server), you can create a .NET non-core web application on IIS (on the same domain), and share the auth-cookie. Then you embed that ReportViewer from the IIS .NET non-core application via iframe (or link with target=_blank) in your .NET Core Web-Application. That way you don't require an SQL-Server license, and no MS-SQL-Server if you, for example, use MySQL/PostgreSQL/Oracle.
Other than wait, you can bundle Apache Tomcat with BIRT into your application, and use Launch4J to redistribute it with the JRE. Then you'll just have to use the Eclipse-BIRT ReportDesigner to create BIRT reports (non-SSRS-reports).
Or you can embed JasperReports with JasperServer.
This would be far more difficult to bin-deploy than BIRT.
But I guess docker to the rescue.
Jasper and BIRT have the advantage that they also run on Linux/Mac.
However, that means you either need the JRE installed on the server, or bin-deploy the JRE along with your application.
Jasper's advantage over BIRT is that it is faster, and that it supports vertical text (not just in the web, and vertical-text is not rendered as image).
There usually are always issues with the BIRT releases downloaded from their website that prevent running BIRT at first. Be that a missing JAVA_HOME environment variable, a missing .jar-dependency or an invalid signature in a .jar file. For information on what it will be on your machine at your time, consult the TOMCAT logfiles, and then google the problem.
The nice thing about BIRT is, that it's comparatively easy to bin-deploy.
Another option would be jsReports, if you like nodeJS.
However, Bin-Deploy that without installation and complications will be even harder (PhantomJS, Webkit, wkHtmlToPdf - for example with an ARM-processor on Raspberry PI).
If you have a few years to spare, you can also just wait until the SSRS team ports to .NET Core - if that happens at all, that is.

Here is a report viewer works on both ASP.NET MVC and ASP.NET Core.
MVC .NET Core Report Viewer

Related

ASP.NET Core Crystal Reports integration

I developed a web application using ASP.NET webforms technology and it contains lots of reports designed by Crystal Reports.
I want to convert my project to ASP.NET Core technology, but I have a problem that's ASP.NET Core does not support Crystal Reports. I searched Google for any help, but did not find any.
I have almost 300 reports. Can you please suggest how to integrate these Crystal Reports with an ASP.NET Core web application?
Crystal Reports does not support .net core, .net 5 or 6, and does not have any immediate plans to support .net core. They offer a couple solutions:
switch to java
hosts the reports it a 4.8 web application, and reverse proxy to it from you asp.net core application.
option 2 is probably your best.
note: .net core applications, nor .net standard libraries, can not call a 4.8 dll.
see thread:
https://answers.sap.com/questions/13029137/crystal-reports-for-visual-studio-and-net-core-5-a.html
One way around this is to decouple the report generation process from the .NET Core process.
For example, the .NET Core process can insert a record into a Report_Job table. That table can include information about not just the rpt file but also parameters and processing options.
Another process can monitor that table, trigger the reports, and remove/update the job records.
There are 3rd-party Crystal Reports tools that can do that (including the ability to update the database based on success/failure of the report job. So no need to reinvent the wheel.
Searched and as you say there is no hope for asp.net core (ref:-https://stackoverflow.com/questions/62057447/how-to-call-reference-crystal-reports-from-net-core ).
But you can do this by achieving :
Add a .net project which supports Crystal report (framework 4.7.1 or read the article - https://answers.sap.com/questions/318288/crystal-reports-in-asp-net-core-20.html) and add all reports in this project. You can add, modify, preview (or test) etc.
Now give the reference in your main application and call report from your code, so this way you can do this.
I have done the same with Telerik report. Good thing that it supports .net core. but having issues to add directly, so add in another project, give reference and then call from main project. Another good thing with this approach is when we go in live/production, as reports having in the different project, we can modify report(s) in designer and publish the report project dll only (not required to publish all projects).

Use Office Interop on ASP.net MVC6 website

I want to generate word documents from my ASP.net MVC 6 website. I've implemented several ways to generate a document in a POC : DocX, NetOffice, OpenXml, COM Interop objects. I was seduced by it.
I made a Console App to test and it works.
But, with ASP.net MVC6, we can't reference Console App's or COM Assemblies.
We need to create "Console App (Package)".
How can I add COM Assemblies to my ASP.net MVC 6 website ?
Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.
If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution.
You can read more about that in the Considerations for server-side Automation of Office article.
Consider using third-party components designed for the server-side execution or if you deal with open XML documents you may use the Open XML SDK, see Welcome to the Open XML SDK 2.5 for Office for more information.

Is it possible to run asp.net mvc 4 from within a folder of a main website?

I have successfully set up an API using ASP.NET MVC 4 on IIS6 (I used Phil's tutorial). When testing, we had it as the "Default website" and so there was no conflict with anything else. I am now being asked to set this up within a FOLDER of an existing website (the existing website is in ASP 1.0...and I cannot modify this...so I would some sort of virtual...something?). So basically, if we have https://www.ourcompany.com, they want the API to be available through https://www.ourcompany.com/api/.
Is this even possible? Phil's tutorial talks about setting up a Virtual Application, but I don't have that option in IIS (and if I had, I'm not knowledgeable enough about IIS to know if that would even allow me to access the API that way). I don't want anything that I set up to mess up the current website either, and there are a couple steps in the tutorial that I'll freely admit I don't fully understand.
If your curious as to WHY, the only advantage (besides being "neat") is so that the same SSL Cert can be used.
Yes that's definately possible at my work we had a similar setup, IIS6, a .NET 3.5 web, with a .NET 4.0 web nested underneath.
You would just set it up as a virtual directory underneath the parent website, point it to your folder, and ensure the value for the "Execute Permissions" dropdown is "Scripts Only" or above, and the correct .NET framework version selected on the ASP.NET tab.
There may be additional values you may need to over-write in your child web.config file, or, alternatively, wrap the entire parent web config with a "Location" attribute.
Forgot to mention, you may need to add manual script mappings for the child web if it doesn't work by default. (This installs the .NET 4.0 script mappings to a specific web) though again not sure if this is required by default. See: http://msdn.microsoft.com/en-us/library/k6h9cz8h.aspx
One more thing - If you're using REST (or an extension less URL mapping which I believe an MVC 4 web will use) - You'll need to add a "wild card" script mapping, which basically tells IIS to serve requests with no extension with the .NET 4.0 framework - See here However where they're referencing .NET 2.0 folders, you'll obviously want to reference the same files but in the .NET 4.0 folders :)
Thanks

Is it possible to make aspnet ModelBinding work in .Net Framework 4.0 Web Forms?

We have a couple of relatively large Web Forms web application projects, but we are limited on using the .net 4.0 because some of our clients are still using Windows Server 2003, and the .net4.5 is not compatible with that OS.
Would it be somehow possible to make the model binding framework created on the .net4.5 work with the .net4.0 WebForms? Maybe something along the lines of extension methods on .net2.0 (although that is obviously almost 100% compile time stuff) or LinqBridge.
If that was possible to some extent, I think I would take the time to do it. Maybe if the code can be extracted from the original sources (I'm downloading them right now to see how it works) and be plugged like an extension or inheritance of sorts in our current page life cycle.
Does that mechanism have some external dependency that would make this prohibitive?
The WebForms-based feature required changes which are only available in 4.5.
That said, if you require model binding in some form, you could always try using the ASP.NET MVC or WebAPI frameworks for the particular part of your site in which you require model binding, leaving the rest as WebForms. They both currently only require .NET 4.0. And you get the benefit that both of those are supported products.

Any tool to convert word and excel to PDF?

Is there any SDK available to convert MS word and Excel files to PDF ? I wan to do it on Web Server at run time. Im using VS 2010, .Net Framewrok 4.0
I looked into MS interop assembly but then this artical pushed me back http://support.microsoft.com/kb/257757
is there any thirdparty tool/SDK/Service available that will do that at runtime?
Check out iText, there is a Java and C# library however I think the .NET library is not free. http://www.itextpdf.com/
If you are after perfect conversion then there is no real solution available / viable other than somehow involving Office. Plain MS-Interop is a nightmare and very unreliable, but there are good third party solutions available.
Give the Muhimbi PDF Converter Services a look. It installs in your environment as a scalable and robust Windows Service and has specifically been designed for use from server based applications such as ASP.NET.
It comes with a friendly web services based interface that allows it to be used from most modern environments such as Java and .NET. It supports all common as well as some not so common file formats. Watermarking and PDF Security is included as well. If you have SharePoint in your environment then a SharePoint optimised version is available as well.
Disclaimer, I have worked on this product so the usual disclaimers apply. Having said that, it works great.
You can use the Save as function which is already available in Microsoft.Office.Interop
doc.SaveAs(ref FileName, Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatPDF);