Tool:Visual Studio 2013 Ultimate
OS:Windows 8.1
.NET Framework : 4.5.1
在ASP.NET Web Site啟用Friendly Url步驟
- New Web Site
- 加入一個Web Form,default.aspx
- 加一個連結,href指向"Manage"
- 加一個Manage.aspx
- 設定h1
- Manage NuGet Package,下載 Microsoft.AspNet.FriendlyUrls.Core
- 加入一個Global.asax
- 加code:
<%@ Application Language="C#" %>
<%@ Import Namespace="Microsoft.AspNet.FriendlyUrls" %>
<script runat="server">
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
var routes = System.Web.Routing.RouteTable.Routes;
var settings = new Microsoft.AspNet.FriendlyUrls.FriendlyUrlSettings( );
settings.AutoRedirectMode = Microsoft.AspNet.FriendlyUrls.RedirectMode.Permanent;
routes.EnableFriendlyUrls( settings );
}
- Test,
- URL部份換掉了,選Manage
- URL換掉了
沒有留言:
張貼留言