程序发布后自定义的httphandler不起作用

scjtswj 2009-03-25 12:01:31
客户端用的shtml页,有部分页面不能直接访问,要经过自定义的httphandler处理过,调试时没问题,发布后httphandler不起作用
部分代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Text.RegularExpressions;

namespace BZone.Common
{
public class UserHttpHandler : IHttpHandler
{
#region IHttpHandler 成员

public bool IsReusable
{
get { return false; }
}

public void ProcessRequest(HttpContext context)
{
HttpRequest Request = context.Request;
//取Url的绝对路径
string Url = Request.Url.AbsolutePath;

int RegStart = Url.LastIndexOf("/") + 1;
//正则
Regex Reg = new Regex(@"[a-zA-Z,]*_p[\d]{1,10}t[\d]{1,10}.shtml");

if (Reg.IsMatch(Url.Substring(RegStart)))
{
context.Response.Write(Url.Substring(RegStart));
}
else
context.Response.Write("");
}

#endregion
}
}

webconfig:

<httpHandlers>
<add verb="*" path="*_p*t*.shtml" type="BZone.Common.UserHttpHandler,BZone.Common" />
</httpHandlers>


...全文
187 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
scjtswj 2009-03-26
  • 打赏
  • 举报
回复
改成html后缀了,不要<!--#include file=""--> 功能了

问题又出来了,即使每次访问的是静态页,只要是.html结尾的,就都到自定义的httpmodule里面执行一遍,
能不能让IIS判断,如果这个文件存在就不到httpmodule执行,直接给他静态页?
gongsun 2009-03-25
  • 打赏
  • 举报
回复
up
阿云ivan 2009-03-25
  • 打赏
  • 举报
回复
帮顶~
scjtswj 2009-03-25
  • 打赏
  • 举报
回复
我把IIS里 网站-属性-主目录-配置-映射 里面的shtml的可执行文件改成了C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
就可以用了,我原来用shtml是想用他<!--#include file=""--> 功能,有没有办法可以2者兼顾?
mmbf001 2009-03-25
  • 打赏
  • 举报
回复
up
zzxap 2009-03-25
  • 打赏
  • 举报
回复
http://www.cnblogs.com/hu88oo/articles/1348171.html
scjtswj 2009-03-25
  • 打赏
  • 举报
回复
UP
scjtswj 2009-03-25
  • 打赏
  • 举报
回复
UP

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧