MS Chart not rendering on MVC 2 with .NET 4


November 17, 2010 by temebele

If you have been using ASP.NET 3.5 Charts, when upgrading to .NET 4 you will ran in to issues with the image source path for ChartImage.axd.

Make sure you add the following to your Global.asax.cs Application_Start.

RouteTable.Routes.Ignore(“{*pathInfo}”,new { pathInfo =@”^.*(ChartImg.axd)$” });

Note: the ignore route for ChartImage.axd needs to be before any area registration.

Technorati Tags: ,

Web.Config Changes:

add assembly=System.Web.DataVisualization, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35/>
add tagPrefix=asp namespace=System.Web.UI.DataVisualization.Charting assembly=System.Web.DataVisualization, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35 />
add path=ChartImg.axd verb=GET,HEAD,POST type=System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35 validate=false/>
<remove name=ChartImageHandler/>
add name=ChartImageHandler preCondition=integratedMode verb=GET,HEAD,POST path=ChartImg.axd type=System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35/>


2 thoughts on “MS Chart not rendering on MVC 2 with .NET 4

  1. Elaine Purse says:

    Thank you so much for this! I was trying to create a chart in a partial view by passing through a chart object as described in and was getting very frustrated at getting an image not found symbol instead of the chart until I found your post.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: