zoukankan      html  css  js  c++  java
  • Url重写

            /// <summary>
            
    /// 重写Url
            
    /// </summary>
            
    /// <param name="sender">事件的源</param>
            
    /// <param name="e">包含事件数据的 EventArgs</param>
            private void ReUrl_BeginRequest(object sender, EventArgs e)
            {
                HttpContext context = ((HttpApplication)sender).Context;
      

                
    string requestPath = context.Request.Path.ToLower();

                
    if (判定)
                {
                       
                        
    foreach (SiteUrls.URLRewrite url in SiteUrls.GetSiteUrls().Urls)
                        {
                            
    if (Regex.IsMatch(requestPath, url.Pattern, RegexOptions.Compiled|RegexOptions.IgnoreCase))
                            {
                                
    string newUrl = Regex.Replace(requestPath.Substring(context.Request.Path.LastIndexOf("/")), url.Pattern, url.QueryString, RegexOptions.Compiled|RegexOptions.IgnoreCase);
                        
                                context.RewritePath(目标
    );

                                
    return;
                            }
                        }
                        context.RewritePath(目标);
                    
                      }

                    }
                }


  • 相关阅读:
    1113. Integer Set Partition (25)
    1110. Complete Binary Tree (25)
    1109. Group Photo (25)
    Bender Problem
    格子中输出
    牌型种数
    移动距离
    QQ帐户的申请与登陆(25 分)
    词频统计
    基于HTTP的直播点播HLS
  • 原文地址:https://www.cnblogs.com/EasyLive2006/p/854313.html
Copyright © 2011-2022 走看看