Reputation: 46322
I am calling a method in C# as follows:
return Chart.RenderChartHTML("../../Charts/MSLine.swf");
The thing is that the path can be different depending on what folder I am calling RenderChartHTML from.
I tried the following so that it finds the absolute path but not working:
string mslinepath = HttpContext.Current.Server.MapPath("~/Charts/MSLine.swf");
return Chart.RenderChartHTML(mslinepath);
Upvotes: 3
Views: 23065
Reputation: 14302
Use ResolveUrl(). It converts a URL into one that is usable on the requesting client.
So Try this instead :
string mslinepath = ResolveUrl("~/Charts/MSLine.swf")
Hope this will help !!
Upvotes: 7
Reputation: 12586
You don't need the ~/
. Just HttpContext.Current.Server.MapPath("Charts/MSLine.swf");
Upvotes: 7