北京时间:
 
 
 首页 
 
 
 
 
 
 
 洛杉矶论坛 
   
洛杉矶华人论坛 |  搜索  |  注册  |  登陆  |  FAQ 
 
 
How to Remove IIS "Server" Header?

 
发表新帖   回复帖子    洛杉矶华人论坛 首页 -> 技术交流
阅读上一个主题 :: 阅读下一个主题  
留言
How to Remove IIS "Server" Header?  引用并回复
 
发布人: Mrs LA   发布于: 2008/05/06, 12:05 pm

可以通过代码实现:
代码:

public class Module : IHttpModule
{
public Module()
{

}

#region IHttpModule Members



public void Dispose()
{
return;
}


public void Init(HttpApplication context)
{
context.EndRequest += new EventHandler(context_EndRequest);
}

void context_EndRequest(object sender, EventArgs e)
{
HttpApplication app = (HttpApplication)sender;
app.Response.Headers.Remove("Server");
}

#endregion




但是仅限于IIS7+.net 3.0+

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.

返回页首
阅览成员资料 (Profile) 发送私人留言 (PM)
从以前的帖子开始显示:   
点评这篇文章
 
1 2 3 4 5
1个人参与评分
发表新帖   回复帖子    洛杉矶华人论坛 首页 -> 技术交流 论坛时间为 PST (美国/加拿大)
1页/共1   
转跳到:  


 
Copyright 2006-2008 www.ChineseInLA.com All rights reserved.