Windows系统、IIS管理器
Visual Studio 2012
一、去除Server版本信息(1)集成模式新建一个类文件,文件请求加载时,去除Server信息,代码如下:using System;using System.Web;using BeidaSoft.ezWeb.Action;using BeidaSoft.ezWeb.Extentions;namespace MyWeb{ public class RemoveServerInfoModule : IHttpModule { #region IHttpModule Members public void Dispose() { //no code nescessary } public void Init(HttpApplication context) { context.PreSendRequestHeaders += new EventHandler(context_PreSendRequestHeaders); } void context_PreSendRequestHeaders(object sender, EventArgs e) { // strip the 'Server' header from the current Response try { HttpApplication app = sender as HttpApplication; if (null != app && null != app.Request && !app.Request.IsLocal && null != app.Context && null != app.Context.Response) { var headers = app.Context.Response.Headers; if (null != headers) { headers.Remove('Server'); } } } catch (Exception ex) { //Log.HandleException(ex); } } #endregion }}
然后配置web.config文件,代码如下:
(2)经典模式①安装URLscan,安装成功后,打开iis,点击对应网站,选择ISAPI筛选器,保证出现一条URLscan的记录
②打开目录C:\Windows\System32\inetsrv\urlscan,编辑UrlScan.ini文件; a.AllowHighBitCharacters=1 b.AllowDotInPath=1 c.RemoveServerHeader=1
二、修改X-Powered-By 打开IIS,点一个站点,再点HTTP响应标头.双击你要修改的如“X-Powered-By”双击,修改成你想要的数据,也可以直接删除。
三、修改X-AspNet-Version 在站点的web.config文件下的
修改URLscan文件时,可根据个人系统网站文件命名等,修改文件内容,具体属性解释,查看相关文档即可