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

                    }
                }


  • 相关阅读:
    Windows 系统变量大全
    linux编程
    CSS 对齐操作
    php 和 表单 简单交互
    HTML <input> placeholder 属性
    HTML <label> 标签
    Chap-4 Section 4.4 C++相关问题
    Chap-4 Section 4.3 COMMON块
    Chap-4 Section 4.2.4 指令修正方式
    Chap-4 Section 4.2.3 符号解析
  • 原文地址:https://www.cnblogs.com/EasyLive2006/p/854313.html
Copyright © 2011-2022 走看看