Choose the right path for files from App Under IIS

I have inherited a .NET application that is hosted in IIS. Previously, this would be my own site in IIS. Now, in my Dev environment, I have to run it under Default WebSite (in Production, it will still work as its own site.

So, in Dev, I had problems downloading scripts and css files, so I immediately clicked on the default website in Dev and adding the application - call the new MyApp application and specify the physical location on the disk.

So, the previous stylesheets would be loaded:

href="/css/folder/mystylesheet.css"

and js files:

src="/jslib/jquery-1.9.1.js"

which worked great when the application is hosted as its own site in IIS and which still needs to happen in Production (just not in my dev). So in dev I need to change css and js as below:

href="~/css/folder/mystylesheet.css" (note ~ added)

src="./jslib/jquery-1.9.1.js" (note . added)

js css MyApp . - , IIS webconfig, Dev/Production, , css, - , -

, , , /Link/Page.aspx, MyApp, -

question

ASP.NET (~) , ~/stylesheets/main.css , /, , , , , , : : foo.net , app/stylesheet, foo.net/stylesheet, foo.net/app/stylesheet

/(.. ) - , -, web.config, Dev , Virtual Application MyApp ( Dev - Web Transform for Production. web.config

+1
1

- , , . , , , :

  • IIS ( )
  • IIS ( )
  • IIS ( ),
  • , DNS ( ) ..
  • , ( )

, :

  • , ,
  • ASP.NET, , , ( ~), IIS

, .

, , , . , , , , , .

+1

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


All Articles