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

                    }
                }


  • 相关阅读:
    事务
    排序算法
    二维数组中的查找
    在Linux中安装Matlab
    null和“”的区别
    【学习笔记】〖九度OJ〗题目1433:FatMouse
    【学习笔记】〖九度OJ〗题目1464:Hello World for U
    year:2017 month:8 day:1
    year:2017 month:07 day:31
    year:2017 month:7 day:27
  • 原文地址:https://www.cnblogs.com/EasyLive2006/p/854313.html
Copyright © 2011-2022 走看看