开发者

Make ~/ reference the root folder (the same folder as web.config is in)

开发者 https://www.devze.com 2022-12-14 22:22 出处:网络
I\'m working on a site in asp.net (my first) which is all going very well. That is until I deployed the app to our test environment, where the ~ (tilde) started referencing a folder parent to the root

I'm working on a site in asp.net (my first) which is all going very well. That is until I deployed the app to our test environment, where the ~ (tilde) started referencing a folder parent to the root of my project.

On my computer the app lives in c:/Documents.../Visual Studio../WebSites/MyApp and ~ resolves correctly.

On the test server it lives in a subfolder to an existing site, so the url to the site (both while testing and once it goes live) is something like domain.com/oldexistingsite/myapp.

On the test server ~/ resolves to the root of domain.com which breaks the urls to my user controls registered in web.config and all other urls using the ~ operator to make relative urls.

Is there any way I can ensure that the ~ operator will resolve paths relative to the root of my app (i.e. the same 开发者_如何转开发folder where web.config file for my app is located)?

Sorry if this is something totally trivial - this is all new to me ;)


Sounds like you didn't make the subfolder an application in IIS; In IIS Manager on the server right click on the subfolder and hit properties, then create an application for the folder. Sorry, I don't have IIS installed on my home PC or I'd give you more complete instructions...

0

精彩评论

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