IIS virtual directory and ASP.NET directory paths

前端 未结 2 1019
心在旅途
心在旅途 2020-12-09 09:51

The problem

I\'m running into the typical virtual-directory dilemma in that you have some paths on your ASP.Net application and you deploy the app in a IIS virtual

相关标签:
2条回答
  • 2020-12-09 10:19

    Are you using the tilde (~) for your paths where you can?

    ~ refers to the root of the virtual Web application....

    ~/images for example.

    0 讨论(0)
  • 2020-12-09 10:19

    If it's just for css files on the client side then using the url directive makes the path relative to that of the style sheet rather than the page:

    h1#title { background: url('dog.gif') no-repeat 0 0; } 
    

    Also if you're on asp.net mvc then you have access to:

    <script src="<%= Url.Content("~/scripts/new.js") %>" type="text/javascript"></script>
    
    0 讨论(0)
提交回复
热议问题