Search code examples
asp.netpropertiesstatichttpmodule

ASP.Net httpmodule private property behaving as static?


I declared a private property in an httpmodule attached to PostAuthenticateRequest this way:

Private Property roles as New List(Of Integer)

Then in the various methods of the module I added a role to the List this way:

roles.Add(AppSettings.AnonymousRoleId)

But I'm experiencing an odd behaviour... each time I refresh the page the roles list becomes longer always adding the same role just like if Private Property roles is remembered on each page refresh. Just like an application static variable. Shouldn't this property be private to the module?


Solution

  • The PostAuthenticateRequest event may be called many times per page. Look here PostAuthenticateRequest fires several times