Results 1 to 4 of 4

Thread: HttpModule PostAuthenticateRequest sender.User is null.

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2008
    Location
    Texas
    Posts
    1,288

    HttpModule PostAuthenticateRequest sender.User is null.

    Ok so I have my httpmodule set up like so:

    VB Code:
    1. Public Class UserLogModule
    2.     Implements IHttpModule
    3.  
    4.     Private WithEvents httpapp As HttpApplication
    5.  
    6.     Public Sub Dispose() Implements System.Web.IHttpModule.Dispose
    7.  
    8.     End Sub
    9.  
    10.     Public Sub Init(ByVal context As System.Web.HttpApplication) Implements System.Web.IHttpModule.Init
    11.         Me.httpapp = context
    12.     End Sub
    13.  
    14.                 Dim app As HttpApplication = CType(sender, HttpApplication)
    15.  
    16.                 Dim file As String = app.Request.FilePath
    17.                 file = Path.GetFullPath(app.Request.MapPath(app.Request.FilePath))
    18.                 Dim fi As New FileInfo(file)
    19.  
    20.                 If Not fi.Extension.ToLower.Contains("aspx") Then
    21.  
    22.                     Dim parts() As String = IO.Path.GetFileName(fi.FullName).Split(New Char() {"-"})
    23.                     If parts.Length = 3 Then
    24.                     ' See if the parent folder is accessible by current user'
    25.                     ' If so, log access to this file.
    26.  
    27.                     end if
    28.                 end if
    29.  
    30. end sub
    31.  
    32.         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
    You down with OOP? Yeah you know me!
    MCAD and MCMICKEYMOUSE (vb.net)

    ----

    If it even kinda helps... rate it : )

    Edit a Multi-page .tif file and save.

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2008
    Location
    Texas
    Posts
    1,288

    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).
    You down with OOP? Yeah you know me!
    MCAD and MCMICKEYMOUSE (vb.net)

    ----

    If it even kinda helps... rate it : )

    Edit a Multi-page .tif file and save.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2008
    Location
    Texas
    Posts
    1,288

    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 : (.
    You down with OOP? Yeah you know me!
    MCAD and MCMICKEYMOUSE (vb.net)

    ----

    If it even kinda helps... rate it : )

    Edit a Multi-page .tif file and save.

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2008
    Location
    Texas
    Posts
    1,288

    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.
    You down with OOP? Yeah you know me!
    MCAD and MCMICKEYMOUSE (vb.net)

    ----

    If it even kinda helps... rate it : )

    Edit a Multi-page .tif file and save.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width