开发者

Application Relative Paths IIS

开发者 https://www.devze.com 2023-03-25 16:43 出处:网络
I\'m moving an web application to a subdirectory from it\'s root and having issues with paths. Old: http://www.domain.com/

I'm moving an web application to a subdirectory from it's root and having issues with paths.

Old: http://www.domain.com/

New: http://www.domain.com/app/

All of the include css, scripts and html links where in this format:

<link rel="stylesheet" type="text/css" href="/styles/menu.css" media="screen"/>

I've changed to:

<link rel="stylesheet" type="text/css" href="./styles/menu.css" media="screen"/>

or

<link rel="stylesheet" type="text/css" href="~/styles/menu.css" media="screen"/>

It works fine on links and others until I go one directory deep where links and paths are broken.

e.g.

开发者_C百科
www.domain.com/app/dir1/
www.domain.com/app/dir2/

There the link url or others (scripts, includes, etc) get duplicate paths.

e.g.

www.domain.com/app/dir1/dir1/
www.domain.com/app/dir2/dir2/

How could I approach this as absolute?


Using ~/style... etc is the easiest solution in ASP.NET but you must put runat="server" in the tag for it to actually work

0

精彩评论

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