I'm having trouble doing what should be something very basic, I'm trying to load an XML file into memory so that it can be parsed w/o disk access (quicker). I need the file loaded by the global.asa, and the file accessed from my dll.
I'm using code that showed up on MS's site, but it's still not working. He're the code.
dll
VB Code:
' Dim objContext As COMSVCSLib.ObjectContext Dim objContext As ObjectContext ' Dim objApplication As ASPTypeLibrary.Application Dim objApplication As Application Dim strXMLFile As String ' On Error GoTo ExitWhile Set mobjRobo = objRobo mstrAppID = strAppID '* * * this isn't working * * * Set objContext = GetObjectContext() 'on next line; objContext = nothing 'Set objApplication = objContext.Item("Application") 'error here Set objApplication = objContext("Application") 'error here strXMLFile = objApplication.Contents("DP69XMLPath") Debug.Print strXMLFile '* * *
the above code keeps getting the error
Object variable or With block variable not set
here's the global.asa code
Code:<SCRIPT LANGUAGE=VBScript RUNAT=Server> Sub Application_OnStart ' Sub Application_OnStart is the procedure that fires everytime your server starts up. ' The .Lock method locks the Application variable so that you can work on it. Application.Lock ' Set eMail constants Application("DP69XMLPath") = "C:\Inetpub\Apps.xml" ' Parser eMailInfo file and set contents variable 'Dim xmlFile as String 'xmlFile = (Server.MapPath("eMailInfo.xml")) ' When complete the toEMailInfo item in the application content collection will be initialized Dim objXMLParser Set objXMLParser = Server.CreateObject("XMLParser.clsXMLParser") objXMLParser.ParseFile(Application("DP69XMLPath")) Set parser = Nothing ' You now need to unlock the application Application.UnLock End Sub </script>


Reply With Quote