using PreSendRequestHeaders Event in global.asax
asp.net, c#, global-asax, iis
Solution
Just use:
protected void Application_PreSendRequestHeaders(Object source, EventArgs e)
{
}
Or instantiate the handler:
protected void Application_Start()
{
PreSendRequestHeaders += new EventHandler(OnPreSendRequestHeaders);
}
protected void OnPreSendRequestHeaders(object sender, EventArgs e)
{
// should work now
}
Problem
I tried to assign the PreSendRequestHeaders Event in the global.asax file in the "Application_Start" method. But this does not work. ``` private void Application_Start() { PreSendRequestHeaders += OnPreSendRequestHeaders; } private void OnPreSendRequestHeaders(object sender, EventArgs e) { // this is not called } ``` The OnPreSendRequestHeaders is not called, why? Is it possible to assign the PreSendRequestHeaders method in the global.asax?