IHttpModule Custom Authentication
-
Hi, I have created a Authentication Class which implements IHttpModule. When it comes to checking to see if the user is authenticated, this class works fine. However, there are some pages that do not require authentication. These are the files that I have: SecurePage.cs - Inherits from Page with a 'IsSecure' property secure.aspx - can only be accessed by authenticated user public.aspx - can be viewed by anyone login.aspx - page where users are redirected to if they try to access secure.aspx and they are not logged in Is it possible to find out what type of page is being accessed via the Custom HttpModule? Thanks in advance.
-
Hi, I have created a Authentication Class which implements IHttpModule. When it comes to checking to see if the user is authenticated, this class works fine. However, there are some pages that do not require authentication. These are the files that I have: SecurePage.cs - Inherits from Page with a 'IsSecure' property secure.aspx - can only be accessed by authenticated user public.aspx - can be viewed by anyone login.aspx - page where users are redirected to if they try to access secure.aspx and they are not logged in Is it possible to find out what type of page is being accessed via the Custom HttpModule? Thanks in advance.
I found that the HttpApplicaion.Context.Handler (type of IHttpHandler) is created before the AcquireRequestState event. The Handler contains all the info that I require. So by subscribing to this event allows you to access the page which is calling the Authentication class. Hopefully this helps someone in the future.