I have a HTTP Module that grabs the AuthenticateRequest and checks the current user's credentials. It all works fine and I thought that I could specify the pages that should be under this system by using web.config like so:
<location path="SignUp.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="Users.aspx">
<system.web>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</location>
.. in which case users.aspx would require authorization but signup.aspx would not. It seems that AuthenticateRequest fires on every page no matter what and there's no method I can find to check whether to run code - such as a FormsAuthentication.IsRequired, or something like that. I've tried using AuthorizeRequest instead but that gives the same result and I've found the UrlAuthorizationModule.CheckUrlAccessForPrincipal method in 2.0, but I'm using 1.1 !
So, how do you check if authorization is required?
'example code from httpmodule
Private Sub Application_AuthenticateRequest(ByVal Source As Object, ByVal e As EventArgs)
'do stuff here
End Sub
Public Sub Init(ByVal context As System.Web.HttpApplication) Implements System.Web.IHttpModule.Init
AddHandler context.AuthenticateRequest, AddressOf Me.Application_AuthenticateRequest
End Sub