Avatar of pete5950
pete5950 asked on

MSXML3.0 Working on some sites but not this one - after hours I am still lost

There appears to be a configuration issue with MSXML3.0 on this Win2K box; but, almost identical code is working on another iste on th sam box. This one site is failing with a non-descriptive error message. I cannot find any refernce anywhere. It is probobly one of those basic stupid things, but is escaping me.

Sample code creates an html file in the IiS home idrectory but instead of populating the .htm file with the code it places "This domain is not configured for this service. Please contact the webmaster to have it enabled." as the only content.

I must be being an idiot - it is working in the dev environment but failing as described on a production server successfully serving similar code in another site.  - THX
sub buildStaticHTML(byVal pgID, byVal pgName)
	if isnumeric(pgID) and len(pgID)>0 and not isnull(pgID) and len(pgName)>0 then
		if pgID=1000 then
			sURL = "http://www.sitename.com/index.asp?cst=true"
			sURL = "http://www.sitename.com/content.asp?pgid="&pgID&"&cst=true"
		end if
		call buildMessageProgress("Source Page: " & sURL,1)
		call buildMessageProgress("Static Page: " & sFileName,1)
		sFileName = pgName&".htm"
		sDirectoryPath = Server.MapPath("../home_directory")
		set oXMLHTTP = Server.CreateObject("msxml2.serverxmlhttp")
		Dim lResolve, lConnect, lSend, lReceive
		lResolve = 100 * 1000
		lConnect = 500 * 1000
		lSend = 100 * 1000
		lReceive = 500 * 1000
		oXMLHTTP.setTimeouts lResolve, lConnect, lSend, lReceive
		' Opens the connection to the remote server pointing to the URL Address.
		oXMLHTTP.Open "GET", sURL, False
		' Sends the http request and returns the data:
		'on error resume next
		if (err.number <> 0) then
			sError = err.description &" -- "& err.source
			bError = true
		end if
		on error goto 0
		if (bError = false) then
			' Create a file for writing the html source code
			Set oFSO	= Server.CreateObject("Scripting.FileSystemObject")
			'on error resume next
			Set oFile	= oFSO.CreateTextFile(sDirectoryPath & "\" & sFileName, True, False)
			sGrabHTML	= BinToText(oXMLHTTP.responseBody, 35000)
			if (err <> 0) then
				response.write "<BR><SPAN CLASS='Error'>ERROR: check details for:"& sURL &"<BR>"& err.description &"<BR>"& err.source
				bError = true
			end if
			on error goto 0
			'sGrabHTML	= ""
			if (bError = false) then
				dim bReschedule : bReschedule = false
				'# Error checking...
				if ( (instr(lcase(sGrabHTML), "<html>") < 1) AND (instr(lcase(sGrabHTML), "</html>") < 1) ) then
					response.write "<BR><SPAN CLASS='Error'>ERROR: File not 100% complete!</SPAN>" &vbcrlf
				end if
				'# Check for 500 100 error message
				if (instr(lcase(sGrabHTML), "500.100") > 0) AND (instr(lcase(sGrabHTML), "internal server error") > 0)then
					response.write "<BR><SPAN CLASS='Error'>ERROR: Suspected 500-100 error page detected</SPAN>" &vbcrlf
				end if
				'# Check for 404 error message
				if (instr(lcase(sGrabHTML), "http 404") > 0) AND (instr(lcase(sGrabHTML), "file not found") > 0)then
					response.write "<BR><SPAN CLASS='Error'>ERROR: 404 error page detected</SPAN>" &vbcrlf
				end if
				'# check for Zero-Sized file
				if ( (len(sGrabHTML) = 0) or (isNull(sGrabHTML)) ) then
					response.write "<BR><SPAN CLASS='Error'>ERROR: zero-sized file created</SPAN>" &vbcrlf
				end if
				'# replace dynamic links with named links
				call buildMessageProgress("Generating Static Links",4)
				chkstr = "content.asp?pgid="
				chkStart = 1
				lastStart = 0
				loc = instr(chkStart, lcase(sGrabHTML), chkstr, 1)
				do while loc > 0 and chkStart > 0
					loc = instr(chkStart, lcase(sGrabHTML), chkstr, 1) + len(chkstr)
					chkStart = loc
					tmpID = mid(lcase(sGrabHTML), loc, 12)
					linkID = ""
					'response.write "<br>" & chkStart &" <br> ! - "&tmpID&"<br>"
					do while isnumeric(left(tmpID,1)) AND len(tmpID)>0 ' chunk out numeric string : char by char checking
						linkID = linkID & left(tmpID,1)
						tmpID = right(tmpID,len(tmpID)-1)
					if blnDEBUG then response.write " **"&linkID&"** "
					if isnumeric(linkID) and len(linkID)>0 then
						pageName = getFileName(linkID)
						if blnDEBUG then response.write "<br>---"&pageName&"---<br>"
						if len(pageName)>0 then
							if left(tmpID,1) = "&" then
								sGrabHTML = replace(sGrabHTML,chkstr&linkID&"&",pageName&".htm?")
								sGrabHTML = replace(sGrabHTML,chkstr&linkID,pageName&".htm")
							end if
							call buildMessageProgress("pageID: "&linkID&"<br>new link:" & pageName & ".htm" ,3)
						end if
					end if
					if chkStart < lastStart then exit do
					lastStart = chkStart
				Set oFile = Nothing
			end if
			Set oFSO = nothing
		end if
		Set oXMLHTTP = nothing
		Set sGrabHTML = nothing
	end if
end sub

Open in new window

Microsoft IIS Web ServerVB Script

Avatar of undefined
Last Comment

8/22/2022 - Mon

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes