.js files not being located by website on Win 2008 Web Edit IIS 7

I have been going around in circles with this for a couple of days now. I usually find what I need without posting.

I have a pretty simple one page website written in asp.net with a c# back end. I have a javascript carousel. My problem is that everything is fully functional in my dev environment (Macbook Pro, Bootcamp Vista, VS 2008).

When I deploy to my dedicated server (Windows 2008 Web Edition IIS7) (first time for me!) I have followed all the advise. I have bound the website to IP. I have ensured that I have an authenticated anonymous user and IIS user.

So I looked at how I was addressing the .js files. I have 3.

<script language="javascript" src="<%=ResolveUrl("Scripts/jquery.min.js")%>" type="text/javascript"></script>
<script language="javascript" src="<%=ResolveUrl("Scripts/jquery.easing.1.3.js")%>" type="text/javascript"></script>
<script language="javascript" src="<%=ResolveUrl("Scripts/slides.min.jquery.js")%>" type="text/javascript"></script>

For the life of me it does not seem as though they are being addressed correctly. I can grab jquery.min.js from <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> and it works partially. All script from the files I address on my server fail.

I tried to debug the javascript too ... I got

SCRIPT5009: '$' is undefined

Now my guess is that it is not defined because the site is not addressing the .js file that has the corresponding code.

If anyone has an idea on this ... or has encountered it before, please do help.

Thank you

* EDIT *

Okay I have this in the HTML

<script language="javascript" src="<%=ResolveUrl("~/Scripts/jquery.min.js")%>" type="text/javascript"></script>
<script language="javascript" src="<%=ResolveUrl("~/Scripts/jquery.easing.1.3.js")%>" type="text/javascript"></script>
<script language="javascript" src="<%=ResolveUrl("~/Scripts/slides.min.jquery.js")%>" type="text/javascript"></script>

When I view page source I have this

<script language="javascript" src="/Scripts/jquery.min.js" type="text/javascript"></script>
<script language="javascript" src="/Scripts/jquery.easing.1.3.js" type="text/javascript"></script>
<script language="javascript" src="/Scripts/slides.min.jquery.js" type="text/javascript"></script>

In fiddler I have this

404 - File or directory not found


You need to put a forward slash after the tilde:


Okay ... this is resolved. What can I say ... it is a little like hitting your head on a kitchen cupboard door. It has been there for years and you use it everyday ... but once in a while you crack your head on it enough to make your eyes water ...

My problem was 2 fold - 1:

When I created my directory in IIS for my new site, I created WebsiteFolder/wwwroot. This was a school boy error. I placed my website into the wwwroot folder. Of course when I addressed anything in the site with ~/ it went to the top of the directory hierarchy. Thus when it then tried to look for ~/Scripts/.... it could not find them (because they were in ~/wwwroot/Scripts...). So I deleted the website and deleted the directory. Recreated the directory WebsiteFolder and applied the user accounts needed. I then bound a newly created site to the new directory.

My second problem was that I added one of the .js files by adding existing item from another site. I am not sure how, but this file had ghosting permissions which meant that my call did not have the correct authorisation for access. I copied the contents, deleted the file and recreated from new. Pasted code and recompiled and publish.

This is my first time in doing this and I have fallen into a noob bear trap. I just hope that this answer assists someone like me :)

Kudos to Michal Klouda who told about Fiddler, with out this application I would never have seen what was going on and establish the cause of my problem. Thanks.

You should write you statement as

<script src='<%=Page.ResolveUrl("Scripts/jquery-1.7.1.min.js")%>' type="text/javascript"></script>

assuming your .aspx are on root folder.




Need Your Help

Single Sign On query in asp.net


I implemented single sign on by reading this article:

Setting header for only one uitableview

ios xcode uitableview

I need help. I have three UITableViews in one UIView. However, I only want one UITableView to have a header. How can I say it in code? I already have the following code. Thanks guys.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.