Session.Initialize problems with .Net and APSNET

I have written a dll that access my notes enviroment and creates a new document in a database. The dll is passed the ReplicaID of the database, plus the form to be used. This all works fine.

The problem I have is when I can this dll from within a dll that runs under the IIS with the user ASPNET. I get the error message: “Notes Error: Could not open ID File” when I try to initialize the session.

I believe the issue is something to do with the HKCU settings as ASPNET is not the current user. If I check the lastused date on the notes.ini, it would appear it is not being referenced, but I believe it is in my Path statement. Can I in anyway direct the session.initialize to a given notes.ini ?

As I say the code must be basically OK as I can use the dll from another programme without any issues.

Public Shared session As NotesSession

Public Shared NotesDb As NotesDatabase

Public Shared Failed As Boolean = False

Public Shared ErrorCode As String

…

Private Shared Function NotesEnvOK(ByVal ReplicaID As String) As Boolean

    NotesEnvOK = True



    Try

        session = New NotesSession()

        Call session.Initialize()

    Catch ex As Exception

        ErrorCode = ex.Message.ToString

        Failed = True

        NotesEnvOK = False

        Exit Function

    End Try



   'Open Note Database

    OpenDatabase(ReplicaID)

    If Not NotesDb.IsOpen Then

        ErrorCode = Error2

        NotesEnvOK = False

        Failed = True

        Exit Function

    End If

End Function

Thanks for your help

Jeremy

Subject: Session.Initialize problems with .Net and APSNET

Found a solution, even if its nt the best.

You have to give ASPNET voll access to the Notes Program and data directories.

I still have an ActiveX problem with an OLE Object, but thats another story.