I have a little problem here. I need to add a trailing slash at the end of each url in the site I\'m working on. I defined all the links inside the site to have a trailing s
Nice clean solution, codingbug!!
Only problem I ran into was double trailing slashes for the home page in MVC3.
Razor example:
@Html.ActionLink("Home", "Index", "Home")
Linked to:
http://mysite.com//
To fix this I tweaked the GetVirtualPath override:
public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values)
{
VirtualPathData path = base.GetVirtualPath(requestContext, values);
if (path != null && path.VirtualPath != "")
path.VirtualPath = path.VirtualPath + "/";
return path;
}