ASP.NET MVC Images / CSS not displaying for web application with website

I have several web applications on my website in IIS 7.5, which will run my MVC2 web application.

WebSite
    * Prod
    * Test1
    * Test2

I have a firewall routing configured to redirect from http://test1.mywebsite.com/xxxtohttp://my.actual.website/Test1

I used Url.Content("~/Content/Site.css"), but CSS is not loading. Looking at the source for the webpage, the URL is displayed as<link href="/Test1/Content/Site.css" ...>

Is there anything I can do to fix this? Perhaps using the IIS URL rewriter module or adding additional rules to my firewall.

+3
source share
3 answers

( ) - IIS ( ), ASP.NET MVC URL- Url.Content.

-, URL- ( ), IIS (URL Rewrite) Url.Content. , , , MVC-, PathHelpers class.

, // URL. , , / - IIS, .

+1

Fail Request Tracing (http://learn.iis.net/page.aspx/266/troubleshooting-failed-requests-using-tracing-in-iis-7/) , , . , , URL Rewrite , , URL Rewrite 2.0.

+2

, CSS .

0
source

Source: https://habr.com/ru/post/1752675/


All Articles