Is it possible to run an MVC application from a virtual directory in IIS7?
Not only that it is possible but it is the preferred way.
Which kind of messes things up for routing.
Not if you use Html helpers when dealing with urls which will take care of this.
Here's a typical example of what you should never do:
<script type="text/javascript">
$.ajax({
url: '/home/index'
});
</script>
and here's how this should be done:
<script type="text/javascript">
$.ajax({
url: '@Url.Action("index", "home")'
});
</script>
Here's another typical example of something that you should never do:
<a href="/home/index">Foo</a>
and here's how this should be written:
@Html.ActionLink("Foo", "Index", "Home")
Here's another example of something that you should never do:
<form action="/home/index" method="opst">
</form>
and here's how this should be written:
@using (Html.BeginForm("Index", "Home"))
{
}
I think you get the point.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…