-
Apr 7th, 2014, 09:38 AM
#1
Thread Starter
Frenzied Member
HttpModule PostAuthenticateRequest sender.User is null.
Ok so I have my httpmodule set up like so:
VB Code:
Public Class UserLogModule
Implements IHttpModule
Private WithEvents httpapp As HttpApplication
Public Sub Dispose() Implements System.Web.IHttpModule.Dispose
End Sub
Public Sub Init(ByVal context As System.Web.HttpApplication) Implements System.Web.IHttpModule.Init
Me.httpapp = context
End Sub
Dim app As HttpApplication = CType(sender, HttpApplication)
Dim file As String = app.Request.FilePath
file = Path.GetFullPath(app.Request.MapPath(app.Request.FilePath))
Dim fi As New FileInfo(file)
If Not fi.Extension.ToLower.Contains("aspx") Then
Dim parts() As String = IO.Path.GetFileName(fi.FullName).Split(New Char() {"-"})
If parts.Length = 3 Then
' See if the parent folder is accessible by current user'
' If so, log access to this file.
end if
end if
end sub
End Class
When I run this in test, [With the module set up in classical mode in web.config (system.web/httpmodules)] it logs everything ok. But when I put the module in the
integrated mode spot in the web.config (web.server/modules) or whatever the sender's
User property is always Nothing. In AuthenticateRequest, PostAuthenticateRequest, AuthorizeRequest and PostAuthorizeRequest. I need that user and it just won't populate.
Its only when I'm making a request for a file via a link click. All my intermediate pages have the user set. Default.aspx, ProcessDocuments.aspx and etc...
Thanks,
Justin
-
Apr 7th, 2014, 09:42 AM
#2
Thread Starter
Frenzied Member
Re: HttpModule PostAuthenticateRequest sender.User is null.
Also, I tried to set the application to use the classical app pool, but the application kept giving me a file or assembly not found error for 'Conversion' at the line in the web.config that I added the modue in httpmodules, under system.web. My httpmodule library doesn't use a 'Conversion' dll so I went back to integrated (defaultappool).
-
Apr 7th, 2014, 10:35 AM
#3
Thread Starter
Frenzied Member
Re: HttpModule PostAuthenticateRequest sender.User is null.
Ok so I compiled my httpmodule and it's dependencies against the 2.0 framework and set the app pool of the application to the classic. Then under classic app pool, enabled 32-bit apps. I also had to define the httpmodule section under the parent site's web.config. Everything fires except non-aspx file or html page resource requests? I've tried to google with no luck on like problems.
If I debug it locally instead of remotely, everything works as intended. I'm not sure why my .pdf requests aren't firing the AuthenticateRequest when deployed : (.
-
Apr 7th, 2014, 11:26 AM
#4
Thread Starter
Frenzied Member
Re: HttpModule PostAuthenticateRequest sender.User is null.
Ok, so what it turned out to be was that subsequent calls to a pdf document do not get an authenticaterequest event raised. That was the problem. How can I force IIS or my application to always authenticate any request? For some reason, sometimes the link shows as visted, other times it doesn't. Not sure why really.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|