Early MVC Pitfalls – Shared Hosting and Action Link
#
I have a great hosting provider - Arvixe and they are on the ball for both my Linux hosting as well as my .NET stuff. So as I started cranking out apps and went to deploy I knew I could count on them to handle the hosting task at hand. So, compile… deploy… and we’re erroring out. Oh! I forgot to set my site to integrated pipeline…. fix that, drop some control f5 and still an issue. So, CustomErrors=OFF, deploy and see that it is an error with the System.Web.MVC assembly. That’s odd, well a google searching showed that this is a bit of known error. To fix, you simply click on the properties of that assembly, and set the “copy local” property to true. More information can be found here:
This dudes blog
and from Haacked himself: clickey
MVC ActionLink returns ?Length= - This was a real WTF for me. Turns out that if you specify a htmlattributes overload for ActionLink and don’t put in something like null for the route values overload, it will append some stupid length=# string to your href.
<%: Html.ActionLink("Home", "Index", "Home", new { @class = "active" })%>
Generates the following html:
Home
So we throw in null for the routeValues overload:
<%: Html.ActionLink("Home", "Index", "Home", null ,new { @class = "active" })%>
and we get the html we want.