views:

24

answers:

1

Im with my first web app and this is my first deploy.

All is working on local, but is not in remote.

I used the web deploy option of VS2010.

First:

<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>

The app knows that Site.css can be found at:

domain.com/VDir/Content/Site.css

But its looking the jquery on:

domain.com/Scripts/jquery...

Its weird that it can found the css but not the jquery.

Ok, I saw here that I can use:

<script src="<%: Url.Content ("~/Scripts/jquery-1.4.1.min.js") %>" type="text/javascript"></script>

With that, I got jquery working.

But... All examples of jquery managing Urls is like:

$.ajax({
     url: "/Home/Index",
     ...

But with that, is looking for:

domain.com/Home/Index

I remember when I Was reading the asp.net mvc book that the routes engine is smart enough to ignore the Virtual Dir. In other words, one part of the url is "domain.com/VDir" and the other is "/Home/Index"

In short, what Im doing wrong? How I can tell my app that is working under a VDIR and all url have the VDir path on the url.

Thank you.

A: 

In your site.master use this script

<script type="text/javascript">
    window.MVCURL = '<%= Url.Action("--Action--","--Controller--") %>';
</script>

now in your jquery you can use

var myRoute = window.MVCURL.replace("--Action--", "yourActionName")
myRoute = myRoute.replace("--Controller--", "yourControllerName")
John Hartsock