I have to create a page scope COM object in ASP for WIN CE device. The Win CE device supports only httpd server.
I tried to create the com object with the statement Server.CreateObject to give it page scope. But I am getting the following error
Parse error in script
Microsoft VBScript runtime error: '800a01b6'
Description: Object doesn't support this property or method: 'Server.CreateObject'
In file: /Polycold_WebGUI/PolyCold_system_home.asp
On line: 13
How can I correct this problems?
Can I give Page Scope for COM object in Win CE ASP?
Result
The method GetUnitModelNumber increments a member variable and returns the result. Initially the value is 0. Each time GetUnitModelNumber is executed the value will increment. As the default object life time is page scope, My expectation is that the second CreateObject call will return the object already created and the value will increment. But I am getting 0 when I executed the following piece of code. What is wrong with the following code?
Dim objAd1,man
Set objAd1 = CreateObject("PolyColdDeviceCmds.SystemCmds")
man1 = objAd1.GetUnitModelNumber()
Set objAd1 = CreateObject("PolyColdDeviceCmds.SystemCmds")
man2 = objAd1.GetUnitModelNumber()
Response.Write(man2)
Response.Write("<script language='javascript'> alert("""&man2&""");</script>")
How can I correct these problems?
As I mentioned here, you cannot use
Server.CreateObjectin asp-WinCE, you should use justCreateObjectinstead. OnlyMapPathandURLEncodeare supported by the Server object in asp-WinCE. See this page in MSDN for details. From this page:Can I give Page Scope for COM object in Win CE ASP?
Page Scope is the default behaviour for any COM object created within an asp page. See this MSDN reference for details. From this page:
This page talks about classic asp in Windows (desktop), not Windows CE. So for Windows CE just replace
Server.CreateObjectbyCreateObjectand you should get the same results.