首先 在web下 添加Global.asax
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Web.Routing;
namespace MXCrmWeb
{
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}
protected void Session_Start(object sender, EventArgs e)
{
}
protected void Application_BeginRequest(object sender, EventArgs e)
{
}
protected void Application_AuthenticateRequest(object sender, EventArgs e)
{
}
protected void Application_Error(object sender, EventArgs e)
{
}
protected void Session_End(object sender, EventArgs e)
{
}
protected void Application_End(object sender, EventArgs e)
{
}
void RegisterRoutes(RouteCollection routes)
{
//Fore 的页面的定义
routes.MapPageRoute("ForeShow", "ForeShow", "~/Fore/hehe.aspx");//首页
routes.MapPageRoute("NewsL", "NewsL", "~/Fore/NewsList.aspx");//查看所有新闻
routes.MapPageRoute("NewV", "NewV/{mid}", "~/Fore/NewView.aspx");//查看新闻详情
}
}
}
在页面上 直接调用就好了: <a href="<%=webroot %>PersonL" >, <a href="<%=webroot %>PersonV/<%=flist[3].id %>">