ISAPI过滤器或http模块 [英] ISAPI filter or http module

查看:57
本文介绍了ISAPI过滤器或http模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以在我的asp.net项目中使用http模块来重写url。但是

只适用于.aspx页面,我的

应用程序中还有许多其他静态页面,例如.htm。 .asp等


我的问题是:

1.是否可以映射所有这些请求(.gif,.jpg,.swf ,. asp,.htm,

无论如何)首先到我的http模块?

2.或者在这种情况下,我必须使用ISAPI过滤器?

I know I can use http module in my asp.net project to rewrite url. However
that is only true for .aspx page, there are many other static page in my
application such as .htm. .asp, etc.

My question is:
1. Is it possible to map all those request (.gif, .jpg, .swf, .asp, .htm,
whatever) to my http module first?
2. Or in this situation, I have to use a ISAPI filter?

推荐答案

您好,


您可以在.net中使用HTTPHandler来处理指定的请求。


你写你的处理程序(做你想做的任何事情)然后你必须

" register"它在你的web.config中。在那里你指定要处理的请求

。这些可以是任何(*)到一个特定文件

(mypage.aspx)。是的,你可以使用

这种方法处理.gif,.jpg,.swf等。


如果你在MSDN上搜索你应该能够在撰写HTTPHandlers时找到几篇

的文章。

问候,


Peter Chadwick(MCP)
< a href =mailto:pe ** @ code-explorers.com> pe ** @ code-explorers.com

Hi,

You could use a HTTPHandler in .net to handle specified requests.

You write your handler (to do whatever you want) then you have to
"register" it in your web.config. In there you specify which requests
to handle. These can be from anything ("*") to just one specific file
("mypage.aspx"). And yes you can handle .gif, .jpg, .swf etc. using
this method.

If you do a search on MSDN you should be able to find a couple of
articles on writing HTTPHandlers.
Regards,

Peter Chadwick (MCP)
pe**@code-explorers.com


谢谢为了您的快速回复。我会尝试的。


Peter Chadwick(MCP)" < PE ** @ code-explorers.com>在消息中写道

news:11 ********************** @ c13g2000cwb.googlegr oups.com ...
Thanks for your quick reply. I will try that.

"Peter Chadwick (MCP)" <pe**@code-explorers.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...


你可以在.net中使用HTTPHandler来处理指定的请求。

你编写你的处理程序(做你想做的任何事情)然后你必须
注册它在你的web.config中。在那里你指定要处理的请求。这些可以是任何(*)到一个特定文件(mypage.aspx)。是的,您可以使用
这种方法处理.gif,.jpg,.swf等。

如果您在MSDN上搜索,您应该能够找到几个
关于编写HTTPHandlers的文章。
问候,

Peter Chadwick(MCP)
pe ** @ code-explorers.com



如果配置IIS来处理这些文件类型,则可以使用http模块

使用ASP.NET请求。


+打开IIS管理器

+选择你的网站

+右键单击,属性

+选择主目录选项卡

+单击配置...按钮


您可以在此处查看应用程序扩展名映射。双击,例如

" .aspx"扩展以查看如何设置到ASP.NET的映射。


您可以为要通过ASP.NET的所有文件类型复制此

(和你的http模块)根据需要添加/编辑。为.gif,

..jpg,。jpeg等添加一个。


请注意,在Server 2003上,您还可以执行通配符映射较低的

列表框,但是这有一些缺点。某些功能

" break"例如默认网页。但是,如果你有一个非常大的数量

的文件类型要映射,你可能想要探索这种方法。


/// M

郭琦铮 < no@sorry.com>在留言中写道

新闻:ef ************** @ TK2MSFTNGP11.phx.gbl ...
You can use an http module if you configure IIS to handle those file-type
requests using ASP.NET.

+ Open IIS Manager
+ Select your website
+ Right-click, Properties
+ Select Home Directory tab
+ Click Configuration... button

You can see the application extension mappings here. Double click on, e.g.
the ".aspx" extension to see how the mapping to ASP.NET is setup.

You can duplicate this for all file types you want to pass through ASP.NET
(and your http module) by Adding / Editing as desired. Add one for .gif,
..jpg, .jpeg, and so on.

Note that on Server 2003 you can also do a wildcard mapping in the lower
listbox, however there are some disadvantages to this. Certain features
"break" such as default webpages. However if you have a very large number
of file types to map, you may want to explore this approach.

/// M
"Guoqi Zheng" <no@sorry.com> wrote in message
news:ef**************@TK2MSFTNGP11.phx.gbl...
我知道我可以用我的asp.net项目中的http模块重写了url。但是只有.aspx页面才有效,我的
应用程序中还有许多其他静态页面,例如.htm。 .asp等

我的问题是:
1.是否可以映射所有这些请求(.gif,.jpg,.swf,.asp,.htm,无论如何)首先到我的http模块?
2.或者在这种情况下,我必须使用ISAPI过滤器?
I know I can use http module in my asp.net project to rewrite url. However
that is only true for .aspx page, there are many other static page in my
application such as .htm. .asp, etc.

My question is:
1. Is it possible to map all those request (.gif, .jpg, .swf, .asp, .htm,
whatever) to my http module first?
2. Or in this situation, I have to use a ISAPI filter?



这篇关于ISAPI过滤器或http模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆