I developed a web application and all my web pages were on root. here is my folder structure.
-Solution
.....js .......xyz.js .....css .......abc.css Page1.aspx Page2.aspx Page3.aspx AppMaster.MasterPage4.aspx (please note they are lying on root)
Page5.aspx (please note they are lying on root)I have referenced my css and js in masterpage like this.
<script src="js/jquery-1.3.2.js" type="text/javascript"></script>
<link href="css/sprysty开发者_如何学Pythonlesheet.css" rel="stylesheet" type="text/css" />
<link href="css/jquery.datepick.css" rel="stylesheet" type="text/css" />
<script src="js/jquery.tools.min.js" type="text/javascript"></script>
<link href="css/scrollable-wizard.css" rel="stylesheet" type="text/css" />
<script src="js/livevalidation.js" type="text/javascript"></script>
<script src="js/qTip.js" type="text/javascript"></script>
<script src="js/jquery.contactable.packed.js" type="text/javascript"></script>
<script src="js/autoLoader.js" type="text/javascript"></script>
<script src="js/jquery.metadata.js" type="text/javascript"></script>
<script src="js/autoNumeric-1.6.2.js" type="text/javascript"></script>
<script src="js/jquery.blockUI.js" type="text/javascript"></script>
Now when i implemented roles to implement page access security via web.config deny users I have placed the pages like this.
-Solution
.....js .....css -Admin ....Page1.aspx ....Page2.aspx -Users ....Page3.aspx Page4.aspx Page5.aspxBut since I've changed the folder structure I am keep getting object expected due to javascript and css is not working either. What should I do now as I am not referencing css and js specifically in every content page. Some pages will be inside specific folders and some will be on root so in this scenario how should I change the css and js location references.
Thanks
Just put a slash in front of each URL to reference them relative to the root:
<link href="/css/sprystylesheet.css" rel="stylesheet" type="text/css" />
精彩评论