views:

14

answers:

1

Hello guys and girls

Been working on a ASP.NET MVC 2 solution for some time now and today I decided to test in in the IIS7 so I could put in on a company server for my colleagues to play with.

However I got quite a surprise when I hosted it. I started to get Javascript errors in code that worked while running it locally in my VS2010.

I was actually getting errors on the initial jQuery command in my script tag, that looks like this

<script language="javascript" type="text/javascript">

$(document).ready(function () {

    SetCSS();

});

So I was searching around and found this post :

My URL was "http://localhost/MVCAjaxJson" I have changed this to "http://localhost/MVCAjaxJson/" and it started working looks like a “/” at the end is required for the call back function. – Prasanth Mar 23 at 11:43

So I tried to add the forward slash to my page so it read

http://localhost:8008/APQ/Secretary/Create/

That solved the Javascript errors, which is fine and all.

But since I use normal routing e.g

 routes.MapRoute(
            "Default", // Route name
            "{controller}/{action}/{id}", // URL with parameters
            new { controller = "Account", action = "LogOff", id = UrlParameter.Optional } // Parameter defaults
        );

I don't have that additional forward slash on my (action)Links which will make the Javascript run without errors. This must be something other people have experienced since I presume most use standard routing and also some form of Javascript, jQuery or not. So is there a work around or a neat trick this to working properly.

Any help is highly appreciated.

Thomas

Blockquote

A: 

With the aid of a colleague we've established that it has to do with my references to the jQuery libs because I also have issues with displaying pictures and other resources.

So there must be some sort of setting in the IIS7 that I haven't configured properly.

My links looks like this in Vs2010

    <script type="text/javascript" src="../../Scripts/jquery-1.4.2.min.js"></script>
<script src="../../Scripts/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script>
<link href="../../Content/Secretary.css" type="text/css" rel="Stylesheet" />
<link href="../../Content/jQuery/ui-lightness/jquery-ui-1.8.2.custom.css" rel="stylesheet"
    type="text/css" />

Any ideas?

Memphis