On Tue, 23 Nov 2004 10:19:50 -0800, Matt Howard <mb*******@yahoo.com> wrote:
¤ Paul,
¤
¤ Thanks for the reference. I followed the instructions on that web page
¤ (including only the Access portion of the code). Here is the code that I
¤ have so far:
¤
¤ ****************
¤ Imports Access = Microsoft.Office.Interop.Access
¤
¤ Public Class WebForm1
¤ Inherits System.Web.UI.Page
¤
¤ Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
¤ System.EventArgs) Handles MyBase.Load
¤ 'Put user code to initialize the page here
¤ End Sub
¤
¤ Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
¤ System.EventArgs) Handles Button1.Click
¤
¤ Dim oAccess As Access.ApplicationClass
¤
¤ 'Start Access and open the database.
¤ oAccess = Server.CreateObject("Access.Application")
¤ oAccess.Visible = True
¤ oAccess.OpenCurrentDatabase("c:\BizRulesProject\bi zrules.mdb",
¤ False)
¤
¤ 'Run the macros.
¤ oAccess.Run("DoKbTest")
¤ oAccess.Run("DoKbTestWithParameter", "Hello from VB .NET
¤ Client")
¤
¤ 'Clean-up: Quit Access without saving changes to the database.
¤ oAccess.DoCmd().Quit(Access.AcQuitOption.acQuitSav eNone)
¤ System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
¤ oAccess = Nothing
¤
¤ GC.Collect()
¤ End Sub
¤ End Class
¤
¤ ****************
¤
¤ I am getting the error "System.UnauthorizedAccessException: Access is
¤ denied." when I click on the button that executes the "Button1_Click"
¤ function.
¤
¤ To try and fix this, I added the ASPNET user to my Inetpub directory and
¤ made sure it was in all of the subfolders (i.e. "wwwroot"). I gave this
¤ user read, write and execute permissions. I also added my local "IUSR"
¤ account and gave the same permissions.
¤
¤ I re-run the web browser and I get the same "Unauthorized Access" error.
¤
¤ I am not exactly sure which user ASP.NET is using to run the
¤ application. I assume it is the "ASP.NET Machine Account". I wanted to
¤ add the IUSR account just to be on the safe side. DO I have the right
¤ user? Am I adding the user to the appropriate folders (Inetpub and
¤ below)?
¤
¤ HELP! I feel like I'm sooooooo close!
¤
¤ Matt
If you're not implementing impersonation then the ASPNET account is being used. You probably also
need to provide sufficient permissions to the folder where the Access database is located so that
the Jet database engine can create and delete the corresponding .LDB file.
Paul ~~~
pc******@ameritech.net
Microsoft MVP (Visual Basic)