הסרת הHEADER של SERVER מאתר דוט נט

24sharon

New member
הסרת הHEADER של SERVER מאתר דוט נט

כמעט כל האופציות שמצאתי ברשת בצעתי ועדיין התגית מוצגת בראווה.
(חשוב לציין שבאפליקציות שיושבות על IIS7 ברגע שמטמיעים את המודול זה עובד הבעיה שלי היא דווקא על IIS 6)

1. enableVersionHeader="false" בקובץ הWEB.CONFIG

2.הוספת מודול (והפניה אליו מקובץ הWEB.CONFIG)


public void Init(HttpApplication context)
{
context.PreSendRequestHeaders += OnPreSendRequestHeaders;
}

public void Dispose() { }

void OnPreSendRequestHeaders(object sender, EventArgs e)
{
HttpContext.Current.Response.Headers.Remove("Server");
}


3. עדכון קובץ הglobal asax


protected void Application_PreSendRequestHeaders(object sender, EventArgs e)
{
// Remove the "Server" HTTP Header from response
HttpApplication app = sender as HttpApplication;
if (null != app && null != app.Request && !app.Request.IsLocal &&
null != app.Context && null != app.Context.Response)
{
NameValueCollection headers = app.Context.Response.Headers;
if (null != headers)
{
headers.Remove("Server");
}
}
}



מה עוד אפשר לבצע על מנת להסיר את ההדר של SERVER????
 
למעלה