How to make script paths inside user control independent of page hierarchy.
Posted
by Rohit
on Stack Overflow
See other posts from Stack Overflow
or by Rohit
Published on 2010-06-03T06:19:34Z
Indexed on
2010/06/03
6:24 UTC
Read the original article
Hit count: 314
ASP.NET
My website is organized in the following folder structure
Root
Pages
CustomerManagement
DepartMentManagement
Script
UserControls
Now i have a user control inside userControl Folder. I have to use a external js file. So i use it this way
<script type="text/javascript" language="javascript" src="../Script/slider.js"></script>
My understanding is that since both are under root so i have used a single .. Now what happens is that when this usercontrol is used inside DepartMentManagement it checks for script folder inside CustomerManagement as .. refers to one hierarchy above and script file is not found.Even using a ~ doesnot work.
I want to make this script path independent of the path where this control is used. I don't want to move script reference code to the page as control requires script mot page.Please tell me how to achieve this.
© Stack Overflow or respective owner