0
votes

I'm using MVC 4 with .NET Framework 4.5.1.

I'm using an external library to create a chart. The html references a dynamically created image,

<img usemap="#MainContent_C1WebChart1_MAP" id="MainContent_C1WebChart1" src="chartimage.aspx?SessionID=FooBar&amp;Delete=T">

But it's looking at /Home/chartimage.aspx?SessionID=FooBar&amp;Delete=T (which returns file not found)

It currently exists under /chartimage.aspx?SessionID=FooBar&amp;Delete=T

What would be the best way to fix this pathing error? I cannot change the src attribute in the img to include a '/' prior to run time it as this is generated by an external library.

Controller: /Controllers/HomeController

View: /Views/Home/Sitemaster and /Views/Home/Default.aspx.

If I make this view the default startup page it works. RouteConfig:

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        );
        //localhost:9000 Works great! But I don't want this as the default page.
        //localhost:9000/Home/Index Doesn't work :( It's trying to get the resource from /Home/chartimage.aspx...
1
you can change the src value using jqueryISHIDA

1 Answers

1
votes

use this link on how to change the src value of an image.

If you want to use Rewrite URL:

   <rule name="Remove en" stopProcessing="true">
    <match url="^(.*)/Home$" />
    <action type="Rewrite" url="{R:1}" />
</rule>

if your example is www.local.com/home/chartimage.aspx will be rewritten as

www.local.com/chartimage.aspx