Question:You are creating an ASP.NET Web site. You create a HTTP module named CustomModule, and you register the module in the web.config file.
The CustomModule class contains the following code.
public class CustomModule : IHttpModule
{
string footerContent = "<div>Footer Content</div>";
public void Dispose() {}
}
You need to add code to CustomModule to append the footer content to each processed ASP.NET page.
Which code segment should you use?
A public CustomModule(HttpApplication app)
{
app.EndRequest += new EventHandler(app_EndRequest);
void app_EndRequest(object sender, EventArgs e)
{
HttpApplication app = sender as HttpApplication;
app.Response.Write(footerContent);
}
B public void Init(HttpApplication app)
{
app.EndRequest += new EventHandler(app_EndRequest);
void app_EndRequest(object sender, EventArgs e)
{
HttpApplication app = new HttpApplication();
app.Response.Write(footerContent);
}
C public customModule();
{
HttpApplication app = new HttpApplication();
app.EndRequest += new EventHandler(app_EndRequest);
}
void app_EndRequest(object sender, EventArgs e)
{
HttpApplication app = sender as HttpApplication;
app.Response.Write(footerContent);
}
D public void Init(HttpApplication app)
{
app.EndRequest += new EventHandler(app_EndRequest);
}
void app_EndRequest(object sender, EventArgs e)
{
HttpApplication app = sender as HttpApplication;
app.Response.Write(footerContent);
}