Thursday, 17 April 2008
Sage on your website
Connecting Sage with your website
Sage Data Objects can run within an ASP.NET web page, which will allow Internet visitors interact with your Sage accountancy software.
Sage requires high levels of permissions to run from a ASP.NET website, which may lead to some security implications. Your web-server should be dedicated, and you will need either physical or remote desktop access to it.
Configuring the Administrator Account
If your Administrator account has a blank password – that is, you are not asked to enter one, when logging onto the machine. Then you will need to configure the account to allow log-ons from non console applications.
Press Start > Run > gpedit.msc
Press Computer Configuration > Windows Settings > Security Settings > Local Policies > Security Options
Click on “Account: Limit local account use of blank password to console log on only”
Select Disable
Configuring IISAdmin Service
IIS will need to be able to interact with the desktop, in order to process Sage instructions. This is achieved thus:
Press Start > Control Panel > Administrative Tools > Services
Right Click on IISAdmin, Select properties
Press Log on
Check “Allow service interact with desktop”
Restart the service
Configuring Machine.config
The ASP.NET worker process (aspnet_wp.exe) will have to run under the Administrator account also, to configure this, you will need to edit the machine.config file
Open C:\windows\Microsoft.net\Framework\v1.1.4322\Config\Machine.config in notepad
Edit the ProcessModel section to add the following
username=”Administrator”
password=””
Then Restart IIS.
Creating a Web Project
Create a new Visual Basic .NET web application project in Visual Studio,
Right Click on References > Add Reference
Select SageDataObjectComponent
Add a Button to the page, named btnConnect, and a DataGrid named dgCustomers
Click the button, and add this code:
Dim sdo50 As SageDataObject50.SageDataObjects
Dim ws50 As SageDataObject50.WorkSpace
sdo50 = New SageDataObject50.SageDataObjects
ws50 = sdo50.GetWorkSpace()
Dim strACCData As String = ConfigurationSettings.AppSettings("ACCDATA")
Dim strUsername As String = ConfigurationSettings.AppSettings("USERNAME")
Dim strPassword As String = ConfigurationSettings.AppSettings("PASSWORD")
ws50.Connect(strACCData, strUsername, strPassword, Guid.NewGuid().ToString())
Dim alCustomers As ArrayList = New ArrayList
Dim srCustomer50 As SageDataObject50.SalesRecord = _ DirectCast(ws50.CreateObject("SalesRecord"), SageDataObject50.SalesRecord)
srCustomer50.MoveFirst()
While True
alCustomers.Add(srCustomer50.Fields.Item("Account_Ref").Value())
srCustomer50.MoveNext()
If srCustomer50.IsEOF() Then Exit While
End While
dgCustomers.DataSource = alCustomers
dgCustomers.DataBind()
ws50.Disconnect()
Your Web.config will need the following values
<appsettings>
<add key="ACCDATA" value="C:\LINE50\ACCDATA\"></add>
<add key="USERNAME" value="MANAGER"></add>
<add key="PASSWORD" value=""></add>
</appsettings>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment