简体   繁体   中英

asp.net path problem when deploying

We have moved a lot of images and javascript file that was inside class to external Javascript file. In development (Debug inside Visual Studio), everything look nice, all images show, all javascript works and all CSS display perfectly. When we do a package and install with IIS ina virtual directory everything that is pointed by the JavaScript doesn't work.

Question : Since we cannot use the tilde (~) in javascript or in CSS what is the way to display those resources?

Edit 1

The problem is the website is installed with a Virtual Directory and if we have in the JavaScript file a popup that has a hardcoded path in the JavaScript the code try to display : " http://localhost/NameSpace/Directory/File.html " instead of " http://localhost/VIRTUALDIRECTORY/NameSpace/Directory/File.html ". Is there a configuration with IIS or inside the code I need to add something like a parameter to pass the path everytime?

In the javascript in dev it work to have something like :

var popWindowPath = '/ProgressFile/Simple/ProgressSlow.htm';

Images for css are, I believe, displayed relative to the css file so that shouldn't be an issue (use relative rather than absolute links).

For the js, either have the ability to pass a base link in as an argument or make .js files parsed as .net pages and include code on those pages.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM