ProcessRequest事件有关问题
ProcessRequest事件问题
以上代码是在 IHttpHandler里的一个伪静态处理,但现在的问题是我希望某个目录不经过这个处理,所以加上了
if (url.StartsWith("/fckeditor", StringComparison.CurrentCultureIgnoreCase) == false)这个条件,
但是现在失败了。/fckeditor目录下的html页面上什么都没有了。好像就是不经过这里处理的话,页面就是空的。
要达到效果,我该怎么写呢。
------解决方案--------------------
你到底要开头等于/fckeditor走下面还是不等于才走下面?
- C# code
public void ProcessRequest(HttpContext context) { if (context == null) return; string url = context.Request.CurrentExecutionFilePath; if (url.StartsWith("/fckeditor", StringComparison.CurrentCultureIgnoreCase) == false) { List<RegexInfo> _regex_list = BLL.CacheHepler.RewriterCache.ReadRewriterRule(context); foreach (RegexInfo r in _regex_list) { //建立正则表达式 Regex Reg = new Regex(r.NewPath, RegexOptions.IgnoreCase); Match m = Reg.Match(RawUrl);//匹配 if (m.Success)//成功 { RawUrl = Reg.Replace(RawUrl, r.RealPath);//匹配出其真实的URL context.Server.Execute(RawUrl); context.Response.End(); return; } } IHttpHandler hander = BuildManager.CreateInstanceFromVirtualPath(RawUrl, typeof(Page)) as IHttpHandler; hander.ProcessRequest(context); } }
以上代码是在 IHttpHandler里的一个伪静态处理,但现在的问题是我希望某个目录不经过这个处理,所以加上了
if (url.StartsWith("/fckeditor", StringComparison.CurrentCultureIgnoreCase) == false)这个条件,
但是现在失败了。/fckeditor目录下的html页面上什么都没有了。好像就是不经过这里处理的话,页面就是空的。
要达到效果,我该怎么写呢。
------解决方案--------------------
你到底要开头等于/fckeditor走下面还是不等于才走下面?