Community
Showing results for 
Search instead for 
Do you mean 
Reply

UnauthorizedAccessException

New Member
Posts: 2
Country: United Kingdom

UnauthorizedAccessException

I'm having some trouble using the SDK with ACT 2010 Premium For Web.

I have installed ACT 2010 Premium For Web on a Windows 2003 server. I have created a Visual Studio C# project and added the Act Framework dlls from the Global Assembly Cache as references. I'm using the following code to initiate a login:


                ActFramework framework = new ActFramework();
                try
                {
                    framework.LogOn(installDir + "\\demo.pad", "Chris Huffman", "");                   
                }
                catch (Exception e)
                {
                    eventLog.WriteEntry(e.ToString());
                    return;
                }

 

 The contents of the demo.pad file are:

<?xml version="1.0" standalone="no"?>
<!DOCTYPE ACTDatabasePADFile>
<!--This file represents a Pointer to an Act Database or [PAD]-->
<ACTDatabase name="ACT2010Demo" host="(local)" location="" type="SQL" />

 

I can access the database fine using the ACT client but everytime I run my application I receive the following exception:

System.UnauthorizedAccessException: Access to the path 'ACT\ACT For Web\' is denied.
   at Act.Framework.ActFramework.FailLogOn(Exception ex, TraceCategory tCat, TraceLevel tLevel)
   at Act.Framework.ActFramework.LogOn(String userName, String password, String databaseType, String databaseHost, String databaseName, Boolean fireEvents, Boolean suppressTierCheck, Boolean suppressSchemaCheck, Boolean suppressLicenseCheck, Boolean allowTrialModeDeparture, LogonTrack tracklogon)
   at Act.Framework.ActFramework.LogOn(String xmlPADFile, String userName, String password)

 

I have tried installing ACT 2010 Premium For Web on another machine running Windows XP and I receive the same exception.

New Member
Posts: 2
Country: United Kingdom

Re: UnauthorizedAccessException

Problem solved.

Turns out the issue is when you run Act Framework code as the system user. The system user doesn't have their own user specific user directory so therefore can not access "%USER%\Act\Act For Web". My good colleague Karl caught on to this and change the windows service we had created to run as an ordinary Windows user and now the framework is working fine.

Let this serve as a warning to anyone else creating Windows services with Act framework code in them. Run as a valid user!