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

                    }
                }


  • 相关阅读:
    python——时间与时间戳之间的转换
    Python3中正则模块re.compile、re.match及re.search
    javascript 模块化开发
    Python细说 xrange 和 range 的区别
    PyInstaller 生成exe文件
    win10安装mysql5.7.14winx64遇到服务无法启动问题解决方法
    Python 自定义队列 数据结构
    spring事务使用心得
    LS 存取文件
    Single Instance Application
  • 原文地址:https://www.cnblogs.com/EasyLive2006/p/854313.html
Copyright © 2011-2022 走看看