IIS 7 Http Handler 开发问题

发布于 2024-08-09 18:40:50 字数 250 浏览 1 评论 0原文

我正在使用 VSTS 2008 + C# + .Net 3.5 + IIS 7.0 开发 ASP.Net 网站。我想开发一个 Http 模块,它可以检查传入请求是否具有某些特定的 http 标头(例如 CustomerID),如果没有这样的标头,我会将用户请求重定向到其他页面。

我想我应该在IIS 7.0集成模式下使用Http Modules进行开发?如果我错了或者有更简单的解决方案,请纠正我。有参考示例或教程吗?我是 IIS 7.0 中 Http 模块开发的新手。

I am using VSTS 2008 + C# + .Net 3.5 + IIS 7.0 to develop an ASP.Net web site. I want to develop an Http module, which could inspect whether incoming request has some specific http header (e.g. CustomerID) and if do not have such header, I will redirect user request to some other pages.

I think I should develop by using Http Modules in IIS 7.0 integrated mode? Please correct me if I am wrong or there is simplier solutions. Any reference samples or tutorials? I am new to Http Module development in IIS 7.0.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吾性傲以野 2024-08-16 18:40:50

有许多文章描述了如何为 ASP.NET 创建标准 HttpModule。可以在 ASP.NET 基础结构 MSDN 库中找到这样一篇文章,标题为“演练:创建并注册自定义 HTTP 模块”。

确保按照该演练中的步骤将模块注册到 IIS 7 集成模式,否则最终会出现类似于以下内容的错误:

“HTTP 错误 500.0 - 内部服务器错误
描述:此应用程序正在使用集成.NET 模式的应用程序池中运行。这是在当前和未来版本的 IIS 上运行 ASP.NET 应用程序的首选模式。
在此模式下,应用程序不应在 /configuration 节中指定 ASP.NET 模块组件。相反,它应该使用 /configuration 部分来加载 ASP.NET 模块组件。”

您可以在 IIS.NET 站点上找到另一篇文章,其中详细介绍了如何为 IIS 7 创建模块和处理程序。本文的标题是“ 开发使用 .NET Framework 的 IIS 7.0 模块和处理程序

There are a number of articles that describe how to create standard HttpModules for ASP.NET. One such article can be found in the ASP.NET infrastructure MSDN Library titled "Walkthrough: Creating and Registering a Custom HTTP Module".

Make sure that you follow the steps to register your module with IIS 7 Integrated mode on that walkthrough or you will end up with an error similar to the following:

"HTTP Error 500.0 - Internal Server Error
Description: This application is running in an application pool that uses the Integrated .NET mode. This is the preferred mode for running ASP.NET applications on the current and future version of IIS.
In this mode, the application should not specify ASP.NET module components in the / configuration section. Instead, it should use the / configuration section to load ASP.NET module components."

You can find another article on the IIS.NET site which has detailed information on how to create both modules and handlers for IIS 7. This article is titled "Developing IIS 7.0 Modules and Handlers with the .NET Framework"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文