We have an old application developed in classic ASP and today it is generating an error while consuming RSS feed. After through investigating(tried to wrote code in .NET to get detailed error) found its special character, in generated output which is causing trouble. When you run RSS feed in browser and run generated XML from local server, it works fine.
Error: System error: -2147012866.
Line: 0
Text:
I have no idea how to fix it.
<%
Dim objXML
Dim objItemList
Dim objItem
Dim I
Set objXML = Server.CreateObject("MSXML2.FreeThreadedDOMDocument")
objXML.async = False
I = 0
objXML.setProperty "ServerHTTPSRequest", True
'objXML.Load(Server.MapPath("abcd.xml"))
objXML.Load("http://search.jobs.wa.gov.au/wagov.rss?agencyID=925")
If objXML.parseError.errorCode <> 0 Then
Response.Write "<pre>" & vbCrLf
Response.Write "<strong>Error:</strong> " & objXML.parseError.reason
Response.Write "<strong>Line:</strong> " & objXML.parseError.line & vbCrLf
Response.Write "<strong>Text:</strong> " & Server.HTMLEncode(objXML.parseError.srcText) & vbCrLf
Response.Write "</pre>" & vbCrLf
End If
%>
Zam,
Even if you correct it from ServerHTTPSRequest to ServerHTTPRequest in SetProperty, still nothing works.
As mentioned in question, it also worked fine when you use saved the XML file(generated from RSS FEED)
Also, if you look into below post, it states that it's all because of encoding="iso-8859-1" which is also the case for above issue.
http://stackoverflow.com/questions/4332828/vbscript-tries-to-read-rss-feeds-have-issue-of-system-does-not-support-the-speci
but solution provided there causes another error that The connection with the server was terminated abnormally
I believe error in objXML.SetProperty "ServerHTTPSRequest", True
Because
Error description: Property name is invalid.
Related
I hope I am placing my question in right place. I could not find closer tags.
I am setting up a new 64 bit system to have everything from my old 32 bit system on it.
I used vb6 to create an activeX dll test project to make a testProj.dll, package it and install it by running the setup.exe of the package as administrator.
My test project is called testProj having a class called testClass which has a simple sub called testSub as follows:
Public Sub testSub()
Response.Write “--------- testSub is called ----------“
End Sub
The testSub simply prints a message to confirm that the sub was called.
I successfully install / register the testProj.dll and on an asp page I successfully call the Server.CreateObject(“testProj.testClass”) to instantiate the testProj for calling its testSub().
On Error Resume Next
Dim testObj
Set testObj = Server.CreateObject(“testProj.testClass”)
if err.number <> 0 then
Response.write "1----------err.number = " & err.number & "--------- err.description = " & err.description
err.clear
end if
Call testObj.testSub()
if err.number <> 0 then
Response.write "2----------err.number = " & err.number & "--------- err.description = " & err.description
err.clear
end if
Set testObj = nothing
But the code generates error with no description:
2----------err.number = -2147164123 ---------err. description =
Also if I comment out the 'Call testObj.testSub()' I do not get any error. Meaning that the source of the error is the call to testSub().
I run everything as administrator so I do not expect any permission issue.
Could an expert tell me what the problem might be?
Thank you
It looks like you are assuming that you have access to the Classic ASP context from inside the COM DLL which will not be the case. The code is failing inside the COM DLL because it doesn't know what Response is which will trigger an Object Required error inside the DLL bubbling up to the Classic ASP page.
The simplest solution is to change what the method is sending back. As you can't call the Response.Write() method directly the next best thing is to return a string instead then use Response.Write() from the ASP page to display it.
Modify the COM DLL method to return a String;
Public Function testSub() As String
testSub = "--------- testSub is called ----------"
End Function
Then in the ASP page;
Call Response.Write(testObj.testSub())
I work in a very large, complex Intranet environment. I have run into a very unique issue that I cannot seem to resolve.
Forwarning
The technologies I mention are very outdated and that is the way is has to stay. I work in a very large enterprise and they have a ton of legacy things in place. I normally work on the modern side of things, but this got placed in my lap.
The problem:
We have a file located on our IIS 7.x server with path \serverName\shareName\wwwroot\myfile.jpg. I need to copy this file to a webDav location of a DIFFERENT web server using ASP , vbscript, or another similar web technology. For a multitude of security implications, I don't have access to the webDav UNC path, only the http: path. I am able to map this drive and access the http: location using windows explorer. I can even manually copy files, create files, and delete them. However, when I try to use a script, I get no where.
I am not great with vbscript so bare with my attempts:
Attempt 1:
Set oShell = CreateObject("WScript.Shell")
strCommand = oShell.Run("Xcopy ""sourceLocation"" ""destination location"" /S /Y", 0, True)
If strCommand <> 0 Then
MsgBox "File Copy Error: " & strCommand
Else
MsgBox "Done"
End If
Attempt 2:
<%
dim objFSOpublish
set objFSOpublish = CreateObject("Scripting.FileSystemObject")
strCurrentUNCfull = "sourcePath"
mPublishPath = "destinationPath"
objFSOpublish.CopyFile strCurrentUNCfull, mPublishPath
set objFSOpublish = nothing
%>
I have no idea if this is even possible to do without the webDav UNC path because I don't have much experience with webDav. If it is possible I have exhausted my limited knowledge in this space and need help badly. I scoured Google tirelessly trying to find a similar issue to no avail. Any and all help or direction will be greatly appreciated.
You're going to want to do something like this:
On Error Resume Next
sUrl = "YourURLHere"
sFile = "UNCPathToYourFile"
'Here we are just reading your file into an ODB
'stream so we can manipulate it
Set oStream = CreateObject("ADODB.Stream")
oStream.Mode = 3
oStream.Type = 1
oStream.Open
oStream.LoadFromFile(sFile)
'Here we are doing the upload of the oStream
'object we just created.
Set oHTTP = CreateObject("MSXML2.ServerXMLHTTP")
oHTTP.Open "POST", sUrl, False
oHTTP.SetRequestHeader "Content-Length", oStream.Size
oHTTP.Send oStream.Read(oStream.Size)
'Check for errors.
If Err = 0 Then
Wscript.Echo oHTTP.responseText
Else
Wscript.Echo "Upload Error!" & vbCrLf & Err.Description
End If
'Optionally close out our objects
oStream.Close
Set oStream = Nothing
Set oHTTP = Nothing
Here is the code I am currently using with the actual file path redacted. Let me know if you see anything that is incorrect.
The page is saved as a .ASP.
<%
sUrl = "http://server.site.com:80/subDomain/wwwroot/"
sFile = "\\server\developmentShare\wwwroot\page.htm"
'Here we are just reading your file into an ODB
'stream so we can manipulate it
Set oStream = Server.CreateObject("ADODB.Stream")
oStream.Mode = 3
oStream.Type = 1
oStream.Open
oStream.LoadFromFile(sFile)
'Here we are doing the upload of the oStream
'object we just created.
Set oHTTP = CreateObject("MSXML2.ServerXMLHTTP")
oHTTP.Open "POST", sUrl, False
oHTTP.SetRequestHeader "Content-Length", oStream.Size
oHTTP.Send oStream.Read(oStream.Size)
'Check for errors.
If Err = 0 Then
Wscript.Echo oHTTP.responseText
Else
Wscript.Echo "Upload Error!" & vbCrLf & Err.Description
End If
'Optionally close out our objects
oStream.Close
Set oStream = Nothing
Set oHTTP = Nothing
%>
I want to use Microsoft indexing service to search a folder which includes the static pages, the following is the source code.
<html>
<%
' This section sets the various configuration variables
formscope="/"
pagesize = 5000
maxrecords=5000
searchstring=request.form("query")
catalogtosearch="cat"
searchrankorder="rank[d]"
origsearch=searchstring
%>
<%
'This section performs the query
dim q
dim util
set q=server.createobject("ixsso.query")
set util=server.createobject("ixsso.util")
q.query=searchstring
q.catalog=catalogtosearch
q.sortby=searchrankorder
q.columns="doctitle, filename, size, write, rank, directory, path"
q.maxrecords=maxrecords
%>
<%
'This section displays the results
set rs=q.createrecordset("nonsequential")
rs.pagesize=pagesize
response.write"<p>Your search for <b>" & origsearch & "</bproduced "
if rs.recordcount=0 then response.write "no results"
if rs.recordcount=1 then response.write "1 result: "
if rs.recordcount>1 then response.write(rs.recordcount) & " results: "
%>
<table border=1><tr><td><b>Title</b></td><td><b>Filename</b></td><td><b>Date / Time</b></td><td><b>Size</b></td><td><b>Relevance</b></td><td><b>Directory</b></td></tr>
<%
do while not rs.EOF
response.write "<tr><td>" & rs("doctitle") & "</td><td>" & "" & rs("filename") & "" & "</td><td>" & rs("write") & "</td><td>" & rs("size") & "</td><td>" & rs("rank") & "</td><td>" & rs("directory") & "</td></tr>"
rs.movenext
loop
response.write "</table>"
set rs=nothing
set q=nothing
set util=nothing
%>
</body>
</html>
I have added a catalog in computer -> management -> indexing service, and under cat catalog, I also add the directory, but when I run the script above there is an error:
CreateRecordset error '80004002'
No such interface supported
/cat/SearchResults.asp, line 31
Anyone knows what is the error? Thanks.
as my original anwser was deleted for some obscure reason i try to answer your question again.
as you could see in this link "You can’t use IXSSO to query an Index Server catalog after you install hotfix 2698365 in Windows 7 or Windows Server 2008 R2".
i copy the text from the linked page to my anwser because #Mario wants that:
SYMPTOMS:
After you install update 2698365 on a computer that is running Windows 7 or Windows Server 2008 R2, you cannot query an Index Server catalog by using the IXSSO component. Specifically, when you try to call the IXSSO.Query.CreateRecordset method, you receive an error message that resembles the following:
No such interface supported -2147467262
CAUSE:
"This issue occurs because an old installation of ActiveX Data Objects (ADO) is removed after you install update 2698365."
RESOLUTION:
install the hotfix from the linked site
I have asp/vbscript code that posts an XML body to a web api, and received back an XML response.
In a browser, (new session) on the first load, it errors out, and this is the message:
err.source = msxml6.dll, err.number = -2146697208 - The download of the specified resource has failed.
On reloading the page, it works, and it works every single time after that until the session times out.
What could be happening here?
The Code is below - fairly standard.
Dim oXmlHttp : Set oXmlHttp = CreateObject("MSXML2.XMLHTTP.6.0")
On Error Resume Next
oXmlHttp.Open "POST", sUri, False
oXmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
oXmlHttp.Send(sRequest)
If Err Then
response.write "err.source = " & err.Source & ", err.number = " & err.number & " - [" & err.Description & "]"
End If
On Error Goto 0
The first thing you should do is stop using XMLHTTP and use ServerXMLHTTP instead. The XMLHTTP is not safe for use in the server context.
I have been trying to create an error handling path for our classic asp website. I have been searching for information for 3hrs now and have not found much even here on stack overflow. So if you can point me towards a duplicate great ... I couldn't find anything although it must exist.
My plan is the following ...
Have proper error handling in the stored procedures. Any errors that occur get inserted into an error table and are also raised back up to the application.
Have "On error resume next" set on the page. Then check the connection.errors collection for errors. As well as Server.GetLastError() property.
If there are any redirect to a page to to display safe error information and insert another record into another database table to tie the page name where the error occurred to the already existing database error in the database table mentioned above for later debugging purposes.
I have created the following page to to begin testing this out. However it is not working.
Dim cmd
Set cmd = Server.CreateObject("ADODB.Command")
cmd.ActiveConnection = con
cmd.CommandType = adCmdStoredProc
on error resume next
cmd.CommandText = "spReturnDBException"
cmd.CommandTimeout = 30 ' 2 minutes
cmd.Execute
dim objErr
set objErr = Server.GetLastError()
if objError.ASPCode <> 0 then
response.write("ASPCode=" & objErr.ASPCode)
response.write("")
response.write("ASPDescription=" & objErr.ASPDescription)
response.write("")
response.write("Category=" & objErr.Category)
response.write("")
response.write("Column=" & objErr.Column)
response.write("")
response.write("Description=" & objErr.Description)
response.write("")
response.write("File=" & objErr.File)
response.write("")
response.write("Line=" & objErr.Line)
response.write("")
response.write("Number=" & objErr.Number)
response.write("")
response.write("Source=" & objErr.Source)
else
response.write("There's nothing wrong.")
end if
Dim objErr2
for each objErr2 in objConn.Errors
response.write("<p>")
response.write("Description: ")
response.write(objErr2.Description & "<br />")
response.write("Help context: ")
response.write(objErr2.HelpContext & "<br />")
response.write("Help file: ")
response.write(objErr2.HelpFile & "<br />")
response.write("Native error: ")
response.write(objErr2.NativeError & "<br />")
response.write("Error number: ")
response.write(objErr2.Number & "<br />")
response.write("Error source: ")
response.write(objErr2.Source & "<br />")
response.write("SQL state: ")
response.write(objErr2.SQLState & "<br />")
response.write("</p>")
next
Free(cmd)
Free(con)
In the stored procedure I simply RAISERROR( N'Lets throw an error because I want to!', 17, 0 );
The output I get every time is as follows ...
ASPCode=ASPDescription=Category=Column=-1Description=File=Line=0Number=0Source=
Description: Help context: Help file: Native error: Error number: Error source: SQL state:
Why am I not getting any error information on the conn.Errors loop?
Resolved.
I was using a different connection object for the loop that loops through the connection.Errors ... copy paste error.
However on a side note ... I found it extremely difficult to find information on how to even do what I've so far.
here's some additional resources:
some general topics:
http://social.msdn.microsoft.com/search/en-US?query=Server.GetLastError%28%29&refinement=89
a specific example:
http://support.microsoft.com/kb/224070