Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.TypeLoadException: 'Could not load type 'System.Web.HttpContextBase' from assembly 'System.Web,

Whenever I try to load the Chart using System.Web.Helpers namespace in Asp.net Core I get this Exception.

System.TypeLoadException: 'Could not load type 'System.Web.HttpContextBase' from assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.'

Please See the image

new System.Web.Helpers.Chart(width: 800, height: 200).AddTitle("My Chart").AddSeries(chartType: "column", 
           xValue: new[] { _context.DemoTable.Select(o => o.Month) },
           yValues: new[] { _context.DemoTable.Select(o => o.AutomationPercentage) }
          ).Write("png");

What am I doing wrong here??

like image 324
Karthik Saxena Avatar asked Apr 06 '18 08:04

Karthik Saxena


1 Answers

the class exists in other namespace so make sure you're using Microsoft.AspNetCore.Mvc and not the .NET framework version.

like image 113
meol Avatar answered Sep 24 '22 19:09

meol