Skip to content

Instantly share code, notes, and snippets.

@alanjuden
Last active November 9, 2016 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alanjuden/9f1524bbee681b92fc87645fe39d20ee to your computer and use it in GitHub Desktop.
Save alanjuden/9f1524bbee681b92fc87645fe39d20ee to your computer and use it in GitHub Desktop.
Custom ReportViewer ReportController Example
public class ReportController : AlanJuden.MvcReportViewer.ReportController
{
protected override ICredentials NetworkCredentials
{
get
{
//Custom Domain authentication (be sure to pull the info from a config file)
//return new System.Net.NetworkCredential("username", "password", "domain");
//Default domain credentials (windows authentication)
return System.Net.CredentialCache.DefaultNetworkCredentials;
}
}
protected override string ReportServerUrl
{
get
{
//You don't want to put the full API path here, just the path to the report server's ReportServer directory that it creates (you should be able to access this path from your browser: https://YourReportServerUrl.com/ReportServer/ReportExecution2005.asmx )
return "https://YourReportServerUrl.com/ReportServer";
}
}
//Only override this property if your controller is not called ReportController.
//You'll want to enter whatever your controller's name is in place of "YourController" below.
protected override string ReportImagePath
{
get
{
//This is the default as an example
//return "/Report/ReportImage/?originalPath={0}";
return "/YourController/ReportImage/?originalPath={0}";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment