Session_Start event not firing

I’ve been scratching my head about this one for sometime…
As I’m sure your aware (or you wouldn’t be reading this) in the Global.asax file, we have the following method:

protected void Session_Start(object sender, EventArgs e)
{
}

Placing a breakpoint on this method, I attached the debugger, ran up my application, and the breakpoint was not hit…

What I would of expected to happen would be the debugger break just as the page is loaded. It didn’t.

When my application builds, I have post-build events that copy required files (.aspx, bin dir etc…) to a separate directory, and i use a custom web server for the project (rather than the standard, local IIS Web server)

What this means is that the Global.asax file needs to be in my output directory.

Nothing in the “Global” class will run without the presence of the Global.asax file.

My post-build events did not copy *.asax files.

Upon adding this line, the issue was fixed, and my breakpoint is now hit.

One response to “Session_Start event not firing”

  1. Petr avatar
    Petr

    Thanks it helps me a lot

Leave a Reply

Your email address will not be published. Required fields are marked *