How to configure Microsoft.AspNet.FriendlyUrls


Imports Microsoft.VisualBasic
Imports System.Web.Routing
Imports Microsoft.AspNet.FriendlyUrls

Public Class RouteConfig
    Public Shared Sub RegisterRoutes(routes As RouteCollection)
        Dim settings = New FriendlyUrlSettings()
        settings.AutoRedirectMode = RedirectMode.Permanent
    End Sub
End Class


<%@ Import Namespace="System.Web.Routing" %>
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
    'Friendly URLs
End Sub

Generate Friendly URLs without string concatenation

<a href="<%: FriendlyUrl.Href("~/Foo", "bar", 34) %>">Click me</a>

if error on server:

Could not load file or assembly 'Microsoft.Web.Infrastructure,
Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
 or one of its dependencies. The system cannot find the file specified

Run ASP.NET MVC 3 Tools Update

related links:

Deixe uma resposta

O seu endereço de email não será publicado. Campos obrigatórios marcados com *