Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
Hello there.
I'm having an issue loading my scripts and css files.
Everything works fine in the application, but the style sheet and the script that I'm using are not working, looks like they doesn't load. I already check the permissions to my folders and I have enabled the static content for the IIS.
I think that this can be handled in the web.config, but I'm not sure.
thanks in advance.

UPDATE:

This is how I'm doing the reference for the scripts:
XML
<script src="/Scripts/jquery-1.4.4.min.js" type="text/javascript"></script>
<script src="/Scripts/jcarousellite_1.0.1.pack.js" type="text/javascript"></script>

That's in my Index/Default page

And this is for the CSS, in the master page:
XML
<link href="/Styles/yahoo-reset-min.css" rel="stylesheet" type="text/css" />
<link href="/Styles/Styles1.css" rel="stylesheet" type="text/css" />
<link href="/Styles/Styles2.css" rel="stylesheet" type="text/css" />


Thanks
Posted
Updated 2-Aug-12 4:47am
v2
Comments
Sergey Alexandrovich Kryukov 1-Aug-12 19:55pm    
How this config file is related to the issue.
--SA

1 solution

Oh, it does, don't worry. IIS "does not care" what to load, it will load whatever you reference via the client's HTTP request. Both jQuery and CSS files are purely client-side entities, so check up presence of the files and their path names in each HTML file using jQuery and CSS. Normally, people use relative path names to reference any kind of files in HTML files; and the relative path should be a path relative to the location of a using file, HTML, .aspx, etc. Just check it up.

—SA
 
Share this answer
 
v2
Comments
AspDotNetDev 1-Aug-12 20:59pm    
Actually, IIS does allow an admin to specify which types of files will be served. You could, for example, prevent any file ending in ".css" from being served up (this is why it won't serve up ".vb" and ".cs" files in a typical configuration). And IIS may not serve up content if a virtual directory has not been setup where the content is located. Otherwise, I agree with you; the user's problem is likely how they reference the files rather than how IIS is configured. They should update their question with the actual page content they are using.
Sergey Alexandrovich Kryukov 1-Aug-12 21:05pm    
Agree. I do feel that OP's problem is just wrong use of those resources.
Good note, thank you very much.
--SA
EddyGuzman 2-Aug-12 11:28am    
SA & AspDotNetDev
You were right...in my solution the references are working fine, but to make them work through the IIS I removed the "/" from the beginning...I don't know why this is a problem, but now it works perfect...thanks. This is something that I have reviewed before but never guess that the slash will have something to do with this...
Sergey Alexandrovich Kryukov 2-Aug-12 12:43pm    
A slash should not be at the beginning of the path. It would mean starting the path from the root (like a volume root), which is not applicable to URL paths which are rooted from the site root. The absolute URL could be used, starting from the scheme (http://subdomain.domain.tld/..., https://subdomain.domain.tld/...). Now you should know why it was a problem. Prefer relative names (they can also start with "./", where '.' represents the "current" directory (location of the document where the URL is used).
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900