记录一次网站漏洞修复过程(二):第一轮处理(IIS目录枚举、应用程序错误)

  • 解决IIS目录枚举

当前的IIS版本为7.5

【IIS】   => 【请求筛选】 => 【URL】中添加 【拒绝序列】 符号  ~ 

  • 应用程序错误

在Global.asax 中添加异常处理代码,当程序出现异常后,记录异常,跳转到预先设置的页面,避免暴漏太多的细节

    void Application_Error(object sender, EventArgs e) 
    {  
        string errorMsg = String.Empty;
        Exception currentError = Server.GetLastError();
        errorMsg += "来自页面的异常处理<br />";
        errorMsg += "系统发生错误:<br />";
        errorMsg += "错误地址:" + Request.Url + "<br />";
        errorMsg += "错误信息:" + currentError.Message + "<br />";
        Log.WriteLog(errorMsg);
        Server.ClearError();
        Response.Redirect("~/err.html");
    }
原文地址:https://www.cnblogs.com/lilunjia/p/7735451.html