3

According to this StackOverflow post, you cannot use the PreApplicationStartMethod to inject code before the Application_Start() method runs when using ASP.NET web forms. Our application is compiled on the fly at runtime, not through Visual Studio or any other build process.

Is there another way to implement the same thing in an ASP.NET web forms codebase? Here is the code we're trying to execute before the Application_Start() method fires:

[assembly: WebActivatorEx.PreApplicationStartMethod(typeof(ASP.App_Start.SessionAuthenticationConfig), "PreAppStart")]

namespace ASP.App_Start
{
    public static class SessionAuthenticationConfig
    {
        public static void PreAppStart()
        {
            DynamicModuleUtility.RegisterModule(typeof(System.IdentityModel.Services.SessionAuthenticationModule));
        }
    }
}
Community
  • 1
  • 1
ianpoley
  • 552
  • 2
  • 10
  • 20

0 Answers0