环境 VS2008 .net3.5不会用UrlRewritingNet组件 等 其他的玩意听说在Global简单 适合我给一份在Global,Application_BeginRequest中url重写的代码不需要在在别的地方配置的直接复制就能用的 最好带点注释

解决方案 »

  1.   

    protected void Application_BeginRequest(object sender, EventArgs e)
      {    string url = HttpContext.Current.Request.RawUrl; //得到原来的url
        //根据规则,新的newUrl
        string newUrl = "xxx.aspx?id=xxx";
        HttpContext.Current.RewritePath(newUrl);
      }
      

  2.   


    你好,网址:HttpContext.Current.RewritePath("NewsCount.aspx?id="+id);
    我想变成这样的  News/id.html就是把www.xxx.com/NewsCount.aspx?id=?
    变成  www.xxx.com/News/?.html把你写的代码补全好吗 万分感谢。