Custom Http Module to add Twitter cards <meta> tags

Nov 9 2015 7:13 AM

CS undergrad here and Im New to asp.net and I'm trying to create a custom Http Module that will add the twitter Cards tags to my site automatically instead of manually implementing the meta tags every time.

I don't have so much to go on in terms of the code I would like help or guidance on where to move after writing my BeginRequest event:

 
 
using System; 
using System.Web; 
namespace ClassLibrary1
 
 { public class Class1 : IHttpModule 
 { public Class1() { } 
 public void Init(HttpApplication app) 
 { // register for events created by the pipeline app.BeginRequest += new EventHandler(this.OnBeginRequest);
 }
 public void Dispose() { } 
 public void OnBeginRequest(object o, EventArgs args) 
 { HttpApplication app = (HttpApplication)o; string query = app.Context.Request.Url.Query; if (query.Contains("ID")) 

 { app.Context.Response.Write("Request intercepted!"); 
 app.Context.Response.Flush(); 
 app.Context.Response.End();}
 }
 }
}