开发者

MVC3 web app running on IIS6 server images not showing up per "/content/themes/base/images" path

开发者 https://www.devze.com 2023-04-10 23:27 出处:网络
I recently published my MVC3 app to an IIS6.0 server and I have the following image reference in a .js script (see code block below) but the images are not showing up.I know that @Url.Content() works

I recently published my MVC3 app to an IIS6.0 server and I have the following image reference in a .js script (see code block below) but the images are not showing up. I know that @Url.Content() works but I can't use that in a .js script.

Q1: What is the proper path to reference for images (or whatever contents)? Thx!

src: '/cont开发者_JS百科ent/themes/base/images/down.gif'

Q2: The following controller/action isn't firing in my ajax/jquery method (I'm sure it's related) but same issue with path:

        $.ajax(
            { url: '/Controller/MyMethod',   // Not firing


Place: @Url.Content("~/Content/Image ...") instead of url only


Paths off the root of your web directory should be prefaced by '~/' like so:

src: '~/content/themes/base/images/down.gif'

This tells the server that the path is relative to the root.

0

精彩评论

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

关注公众号