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(目标);
                    
                      }

                    }
                }


  • 相关阅读:
    [LintCode] 1563. Shortest path to the destination
    [LintCode] 1835. Number of Ways to Stay in the Same Place After Some Steps I
    [Algo] 140. Maximum Path Sum Binary Tree III
    [Algo] 141. Binary Tree Path Sum To Target III
    [LintCode] 597. Subtree with Maximum Average
    [LintCode] 596. Minimum Subtree
    [LC] 16. 3Sum Closest
    [Algo] 182. 2 Sum All Pair II
    [Algo] 181. 2 Sum All Pair I
    创建ORACLE 查询用户
  • 原文地址:https://www.cnblogs.com/EasyLive2006/p/854313.html
Copyright © 2011-2022 走看看