Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<System.Web.UI.DataVisualization.Charting.Chart>" %>
Model.Page = this.Page;
var writer = new HtmlTextWriter(Page.Response.Output);
public class ChartController: Controller
public ActionResult MyChart()
var chart = new Chart();
// Configure chart
return View(chart);
protected void Application_Start()
// It's importat that this ignore of any url ending with ChartImg.axd is inserted before any Area route registrations.
// If you won't use Charts in any Area you can put it in your RegisterRoutes() method.
RouteTable.Routes.Ignore("{*pathInfo}", new { pathInfo = @"^.*(ChartImg.axd)$" });
// The rest..
<% Html.RenderPartial("Chart", Model); %>
<?xml version="1.0"?>
<!-- Your stuff -->
<add key="ChartImageHandler" value="storage=file;timeout=20;" />
<!-- Your stuff -->
<compilation debug="true" targetFramework="4.0">
<!-- Other assemblies -->
<add assembly="System.Web.DataVisualization, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<!-- Your stuff -->
<!-- Other handlers -->
<add path="ChartImg.axd" verb="GET,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
<!-- Your stuff -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment