Creating Resource ASP Pages
The following sample code shows how to create a resource in an ASP page.
<%@ Language=VBScript %>
<% Option Explicit %>
<!-- #include virtual="/admin/inc_framework.asp" -->
<%
Call ServeMemoryStatus()
Private Function ServeMemoryStatus()
on error resume next
Dim objLocator
Dim objNameSpace
Dim oProvider
Dim L_CAPTION_TEXT
Dim L_HOVER_TEXT
Dim L_UNITOFMEASURE_TEXT
Dim MEMORY_RESOURCE_IMAGE
L_CAPTION_TEXT = "Physical memory available"
L_UNITOFMEASURE_TEXT = " (Kb)"
L_HOVER_TEXT = "This shows how much physical memory is currently available on the appliance."
MEMORY_RESOURCE_IMAGE = ""
Set objLocator = Server.CreateObject("WbemScripting.SWbemLocator")
If ( Err.Number <> 0 ) Then
' Handle error here
End If
Set objNameSpace = objLocator.ConnectServer(".","root\CIMV2")
If ( Err.Number <> 0 ) Then
' Handle error here
End If
Set oProvider = objNameSpace.Get("Win32_PerfRawData_PerfOS_Memory")
Set oProvider = oProvider.Instances_
If ( Err.Number <> 0 ) Then
' Handle error here
End If
Dim oSystem
Dim sURL
sURL = "sample/resources/sh_resource_memory_details.asp"
For each oSystem in oProvider
Dim sMemory
sMemory = CStr(oSystem.AvailableKBytes) + L_UNITOFMEASURE_TEXT
Call SA_ServeResourceStatus(MEMORY_RESOURCE_IMAGE, L_CAPTION_TEXT, L_HOVER_TEXT, sURL, SA_DEFAULT, sMemory)
Next
End Function
%>