مشکل امنیتی FreeTextBox و روش رفع آن
نویسنده: وحید نصیری
تاریخ: ۱۳۸۸/۰۳/۱۸ ۲۲:۴۰:۰۰
آدرس: www.dntips.ir
| مطالب | ۳۶۹۴ |
| نویسندگان | ۲۷۶ |
| گروههای مطالب | ۱۰۲۴ |
| نقشههای راه | ۱۱۹ |
| دورهها | ۱۴ |
| اشتراکها | ۱۷۹۱۴ |
protected void Application_BeginRequest(Object sender, EventArgs e)
{
List<string> toFilter = new List<string> { ".aspx", ".asax", ".asp", ".ashx", ".asmx", ".axd", ".master", ".svc" };
if (HttpContext.Current != null && HttpContext.Current.Request != null && HttpContext.Current.Request.Files != null)
for (int i = 0; i < HttpContext.Current.Request.Files.Count; i++)
{
string fileNamePath = HttpContext.Current.Request.Files[i].FileName.ToLower();
string name = Path.GetFileName(fileNamePath);
string ext = Path.GetExtension(fileNamePath);
if (toFilter.Contains(ext) || name == "web.config")
{
HttpContext.Current.Response.StatusCode = 403; //Forbidden
HttpContext.Current.Response.End();
}
}
}