Reputation: 2982
I looked for a similar thread, and didn't find a solution. My problem is:
It all works when I run it in local host, the layouts .css and everything.
Problem: When I put it in IIS
I read this is a common problem, but haven't found how to solve it, any help appreciated.
Additional info
Here are pieces from the code in various parts
@{
Layout = "~/Views/Shared/_Layout_Green.cshtml";
}
<link rel="Stylesheet" type="text/css" href="@Url.Content("~/Content/history.css")" />
<script type="text/javascript" src="@Url.Content("~/Scripts/history.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/swfobject.js")"></script>
<script type="text/javascript">
var swfVersionStr = "10.0.0";
var xiSwfUrlStr = "/swf/playerProductInstall.swf";
swfobject.embedSWF("/swf/QrCodeReader.swf", "flashContent", "350px", "350px", "10.0.0", xiSwfUrlStr, flashvars, params, attributes);
swfobject.createCSS("#flashContent", "display:block;text-align:left;");
<li><img src="/Content/Images/flower.png" width="700" height="300" alt="" /></li>
Upvotes: 4
Views: 3824
Reputation: 30152
fyi - download fiddler and you can easily what uris are being requested and your 404 errors.
Upvotes: 0
Reputation: 4951
Try using the @Url.Content
syntax for the paths you're using within your javascript. That will ensure the paths are created correctly regardless of how your virtual directories are setup.
var xiSwfUrlStr = '@Url.Content("~/swf/playerProductInstall.swf")';
swfobject.embedSWF('@Url.Content("~/swf/QrCodeReader.swf")', "flashContent", "350px", "350px", "10.0.0", xiSwfUrlStr, flashvars, params, attributes);
<li><img src='@Url.Content("~/Content/Images/flower.png")' width="700" height="300" alt="" /></li>
Upvotes: 7
Reputation: 8440
Try using:
<%= ResolveUrl("~/Content/Images/flower.png") %>
That should definitely do it.
Upvotes: 0