网站建设教程 mysql,北京网站手机站建设公司,展厅装修设计,百度网站链接提交入口ASP MVC开发的Web默认情况下会在请求的回应中暴露Server、X-AspNet-Version、X-AspNetMvc-Version、X-Powered-By等相关服务端信息#xff0c;公开这些敏感信息会存在一定的安全风险。 X-SourceFiles标头用于被IIS / IIS Express中某些调试模块理解#xff0c;它包含到磁盘上…ASP MVC开发的Web默认情况下会在请求的回应中暴露Server、X-AspNet-Version、X-AspNetMvc-Version、X-Powered-By等相关服务端信息公开这些敏感信息会存在一定的安全风险。 X-SourceFiles标头用于被IIS / IIS Express中某些调试模块理解它包含到磁盘上源文件的base64编码路径并用于将页面生成的输出链接回该源文件只在本机请求下生成应用程序部署到实际服务器时并不会出现无需担心 https://www.cnblogs.com/xixifusigao/p/3953279.htmlhttps://www.orcode.com/question/1214535_kf9ca5.html (以下转载自https://www.cnblogs.com/namexiaoqi/p/10981224.html) 一、隐藏X-AspNetMvc-Version
在Global.asax文件的Application_Start方法中添加
MvcHandler.DisableMvcResponseHeader true;
二、移除 Header 中的 Server
在Global.asax文件中添加
protected void Application_PreSendRequestHeaders(object sender, EventArgs e)
{var app sender as HttpApplication;if (app null || app.Context null){return;}// 移除 Serverapp.Context.Response.Headers.Remove(Server);
}
三、移除 X-Powered-By
在Web.config文件中添加
system.webServer!-- 其它内容 --httpProtocolcustomHeaders!-- 移除 X-Powered-By --clear /!-- 还可以添加自己的 X-Powered-By 做为标识 --add nameX-Powered-By valuebbb.com //customHeaders/httpProtocol
/system.webServer
四、移除X-AspNet-Version
在Web.config文件中httpRuntime enableVersionHeaderfalse /
httpRuntime enableVersionHeaderfalse /