开发者

Charting with ASP.Net MVC 3 and Areas

开发者 https://www.devze.com 2023-02-12 19:34 出处:网络
I have a MVC 3 website that I am integrating the Microsoft charting into.The section I want to add this to is segregated into it\'s own area of the website.I have the charting working except for the p

I have a MVC 3 website that I am integrating the Microsoft charting into. The section I want to add this to is segregated into it's own area of the website. I have the charting working except for the paths to ChartImg.axd which are what render the image because it is being called from the area all of the resource calls ha开发者_运维知识库ve that path tacked on. Example:

/area/controller/ChartImg.axd

This does not work as it is trying to call the resource relatively.

If I change the URL so that the ChartImg.axd is in the root it displays the chart, so I know they are being made. I would prefer not to save these images as they are being updated frequently, but if I have to do that then I will.


There are two ignore routes that are required so that the area does not try to alter the url for ChartImg. Once these are added to the RegisterArea function inside of the area the paths to the charts is correctly displayed.

context.Routes.Ignore("{controller}/{resource}.axd/{*pathInfo}");
context.Routes.Ignore("{controller}/{action}/{resource}.axd/{*pathInfo}");
0

精彩评论

暂无评论...
验证码 换一张
取 消