BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
public partial class HomeController : Controller, IReportController
{
private IMemoryCache _cache;
private IHostingEnvironment _hostingEnvironment;
public HomeController(IMemoryCache memoryCache, IHostingEnvironment hostingEnvironment)
{
_cache = memoryCache;
_hostingEnvironment = hostingEnvironment;
}
[HttpPost]
public object PostReportAction([FromBody] Dictionary<string, object> jsonResult)
{
return ReportHelper.ProcessReport(jsonResult, this, this._cache);
}
[ActionName("GetResource")]
[AcceptVerbs("GET")]
public object GetResource(ReportResource resource)
{
return ReportHelper.GetResource(resource, this, _cache);
}
[HttpPost]
public object PostFormReportAction()
{
return ReportHelper.ProcessReport(null, this, this._cache);
}
public void OnInitReportOptions(ReportViewerOptions reportOption)
{
reportOption.ReportModel.ReportServerCredential = new System.Net.NetworkCredential("<no user>", "<no password>");
Reportserver reportserver = new Reportserver(_hostingEnvironment);
reportOption.ReportModel.ReportingServer = reportserver;
}
public void OnReportLoaded(ReportViewerOptions reportOption)
{
}
}
public class Reportserver : ReportingServer
{
private IHostingEnvironment _hostingEnvironment;
public Reportserver(IHostingEnvironment hostingEnvironment)
{
_hostingEnvironment = hostingEnvironment;
}
public override Stream GetReport()
{
string basePath = _hostingEnvironment.WebRootPath + "/ReportData/";
FileStream inputStream = new FileStream(basePath+this.ReportPath+".rdl", FileMode.Open, FileAccess.Read);
return inputStream;
}
}
|