问题描述
我正在新闻网站上工作,Asp.net 4.0 C#
我想执行URL重写,我读了很多页并做了说明,但是它没有正常工作!
这是我的主要网址:http:// news.ariavid.com/articles.aspx?id=3
我在Global.asax中写了这些代码:
添加此命名空间:using System.Web.Routing;
protected void Application_Start(object sender,EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapPageRoute(article-browse,articles / {id},〜/ articles.aspx);
}
但我没有任何变化!
请帮我解决问题,
提前致谢。
shery
Hi,
I am working on a news website, Asp.net 4.0 C#
I want to perform URL Rewriting, I read many pages and did its instructions, but it has not been working properly!
It is my main URL: http://news.ariavid.com/articles.aspx?id=3
I wrote these codes in Global.asax:
add this Namespace: using System.Web.Routing;
protected void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapPageRoute("article-browse", "articles/{id}","~/articles.aspx");
}
but I don't have any changes!
Please Help me to solve the problem,
Thanks in advance.
shery
推荐答案
这篇关于路由URL重写中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!