如何在asp.net中重写两个detals页面的url [英] how to re-write url of two detals pages in asp.net

查看:90
本文介绍了如何在asp.net中重写两个detals页面的url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1页是产品详细信息页面

2所有产品根据品牌



我在global.aspx中使用url重写一页工作

我的代码是



  void  Application_Start( object  sender,EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
RegisterRoutes1(RouteTable.Routes);
应用程序[ k] = 0 ;
}

静态 void RegisterRoutes(RouteCollection routes)
{
routes.MapPageRoute( Product_detail {Name} / {id} .html 〜/产品/ Product_detail.aspx);


}





  void  Session_Start( object  sender,EventArgs e)
{
// 新会话启动时运行的代码
Application.Lock();
应用程序[ v] =(( int )应用程序[ k] + 1 );

Application.UnLock();

}

解决方案

这里有一篇文章:在ASP.NET(WEBFORM)路由中使用MapPageRoute方法 [ ^ ]

1 page is product details page
2 All products according to brands

I am using url rewrite in global.aspx by which one one page is working
my code is

void Application_Start(object sender, EventArgs e)
   {
      RegisterRoutes(RouteTable.Routes);
      RegisterRoutes1(RouteTable.Routes);
      Application["k"] = 0;
   }

   static void RegisterRoutes(RouteCollection routes)
   {
       routes.MapPageRoute("Product_detail", "{Name}/{id}.html", "~/Products/Product_detail.aspx");
      

   }



void Session_Start(object sender, EventArgs e)
    {
        // Code that runs when a new session is started
        Application.Lock();
        Application["v"] = ((int)Application["k"] + 1);

        Application.UnLock();

    }

解决方案

There is an article right here: USE OF MapPageRoute Method IN ASP.NET(WEBFORM) ROUTING[^]


这篇关于如何在asp.net中重写两个detals页面的url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆