sách gpt4 ăn đã đi

c# - Response.Headers.Add() 与 Response.AddHeader()

In lại Tác giả: Walker 123 更新时间:2023-11-30 13:57:15 29 4
mua khóa gpt4 giày nike

在我注意到我的代码可能在以经典模式设置的服务器上运行之前,我一直在使用 Response.Header.Add()。在这种情况下,异常“此操作需要 IIS 集成管道模式”。被提出。

我切换到 Response.AddHeader() 来解决我的问题。此功能似乎较旧,但并未弃用。我想知道,您是否认为有任何理由使用 Response.Header.Add() 而不是 Response.AddHeader()?你能解释一下吗?

câu trả lời hay nhất

Response.AddHeader() 是一种较旧的方法,适用于 IIS6。 Response.AddHeader 为您提供了一种将自定义 header 添加到 Response Headers 集合的基本方法,但实际上并没有为您提供以其他方式操作该集合的方法(例如,您不能从集合中删除 header - 尽管您可以使用 Response.ClearHeaders()) 清除它们。 Response.Header.Add()较新,需要Integrated Pipeline Mode才能运行,只有IIS7及以后才支持...

"The Headers property is only supported with the IIS 7.0 integrated pipeline mode and at least the .NET Framework 3.0. When you try to access the Headers property and either of these two conditions is not met, a PlatformNotSupportedException is thrown." -Linky

据我了解,IIS6 使用 ASAPI 调用 .Net,有效地限制了响应 header 等内容的使用方式。借助 IIS7 集成模式,“将 ASP.NET 请求管道与 IIS 核心请求管道相结合的统一请求处理管道”,在请求/响应生命周期内提供更大的工作灵 active ...

这里有几个链接可以帮助您阐明主题 - Moving an ASP.Net Application from IIS 6.0 to IIS 7.0HTTP Request Lifecycle Events in IIS Pipeline that every ASP.NET Developer Should Know .

希望对您有所帮助!

关于c# - Response.Headers.Add() 与 Response.AddHeader(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22204157/

29 4 0
Walker 123
Hồ sơ

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá taxi Didi miễn phí
Phiếu giảm giá taxi Didi
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress