This blog explain how to filter your html. You may want to replace some word with another or you may delete some world in html.You have to configure your webconfig file and write your module in the <modules> tab .This code handle client request and change it when posting this request to client.
Code
/// <summary>/// Html içeriğinin kelime filtrelemsini sağlayan modül
/// </summary>
public class WordFilterModule : IHttpModule
{
/// <summary>
/// Oluşturulduğunda çalışacak metod
/// </summary>
/// <param name="app"></param>
public void Init(HttpApplication app)
{
app.ReleaseRequestState += new EventHandler(InstallResponseFilter);
}
/// <summary>
/// Filtrenin yüklenmesini sağlayan metod
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void InstallResponseFilter(object sender, EventArgs e)
{
HttpResponse response = HttpContext.Current.Response;
HttpRequest request = HttpContext.Current.Request;
//if (GeneralFunction.UsersResponces.ContainsKey(HttpContext.Current.User.Identity.Name))
//{
// GeneralFunction.UsersResponces[HttpContext.Current.User.Identity.Name] = HttpContext.Current;
//}
//else
//{
// GeneralFunction.UsersResponces.Add(HttpContext.Current.User.Identity.Name, HttpContext.Current);
//}
if (response.ContentType == "text/html")
{
//Debug.Write("in InstallResponseFilter()");
response.Filter = new ModifyHtmlContentFilter(response.Filter);
}
}
/// <summary>
///Nesne ramden silindiğinde çalışacak metod
/// </summary>
public void Dispose()
{ }
}
Hiç yorum yok:
Yorum Gönder