Hello.
Why is my "mystyle.css" executes/rendered only at "default route" (in VS 2013) ?
My simple web-app is tested from Visual Studio 2013:
At startup, I see the program runs in firefox: "http://localhost:57613//Home/Index".
In other words the Index action method of my home-controller is run.
My "_ViewStart.cshtml" file contains this:
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
And my "~/Views/Shared/_Layout.cshtml" contains (among others) this:
. . .
<link rel="stylesheet" type="text/css" href="mystyle.css" media="screen">
. . .
<div>@RenderBody()</div>
. . .
STRANGE - WHAT HAPPENS HERE:
When the browser executes: "http://localhost:57613//Home/Index" (and all other action methods of the Home controller),
the CSS-file "mystyle.css" is not rendered (the rendered html is NOT formatted as intended by mystyle.css).
BUT when I force the address-line of my browser to "http://localhost:57613//", my outputted code is rendered OK (acc. to mystyle.css) !?
And: when I put a breakpoint at the Index-method of my Home-controller and single-step my code,
it seems like it's the same code that's executed/rendered in both situations/cases described (though with different output).
What's wrong ?
How can I get my code to render "mystyle.css" when executing the various Home-controller action methods ?
I'll appreciate comments to this issue.
Regards Terje Bøhler
Why is my "mystyle.css" executes/rendered only at "default route" (in VS 2013) ?
My simple web-app is tested from Visual Studio 2013:
At startup, I see the program runs in firefox: "http://localhost:57613//Home/Index".
In other words the Index action method of my home-controller is run.
My "_ViewStart.cshtml" file contains this:
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
And my "~/Views/Shared/_Layout.cshtml" contains (among others) this:
. . .
<link rel="stylesheet" type="text/css" href="mystyle.css" media="screen">
. . .
<div>@RenderBody()</div>
. . .
STRANGE - WHAT HAPPENS HERE:
When the browser executes: "http://localhost:57613//Home/Index" (and all other action methods of the Home controller),
the CSS-file "mystyle.css" is not rendered (the rendered html is NOT formatted as intended by mystyle.css).
BUT when I force the address-line of my browser to "http://localhost:57613//", my outputted code is rendered OK (acc. to mystyle.css) !?
And: when I put a breakpoint at the Index-method of my Home-controller and single-step my code,
it seems like it's the same code that's executed/rendered in both situations/cases described (though with different output).
What's wrong ?
How can I get my code to render "mystyle.css" when executing the various Home-controller action methods ?
I'll appreciate comments to this issue.
Regards Terje Bøhler