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
Related
I’m successfully reading the server event log to display SSIS errors from the Application event log. The aim is to make it possible to do first line troubleshooting without having to log into the server as an Administrator.
I’m using the EventLogEntry in vb.net to show Errors where the source is SQLISPackage110. However what’s stumping me is that when viewing the errors in the event log there is a “Source Name” property that displays the package name. However the EventLogEntry doesn’t seem to have this property which makes it impossible to tell which package has returned the error.
Has anyone come across this and managed to find a way round it?
A screenshot of the error and some of my vb.net code is below
Dim myEventLogEntryCollection As EventLogEntryCollection = myEventLog1.Entries
myEventLog1.Close()
Dim x As Integer
Dim entry As EventLogEntry
If myEventLogEntryCollection.Count > 0 Then
strTable += "<table class='table table-bordered'><tr><th>Time Written</th><th>Source</th><th>Event type</th><th>Message</th></tr>"
For Each entry In myEventLogEntryCollection.Cast(Of EventLogEntry).Reverse 'cast and reverse to show newest first
If entry.Source = strEventSource And (entry.EntryType.ToString = "Error" Or entry.EntryType.ToString = "Warning") Then
strTable += "<tr>"
strTable += "<td>" + entry.TimeWritten.ToShortDateString + " " + entry.TimeWritten.ToShortTimeString + "</td>"
strTable += "<td>" + entry.Source.ToString + "</td>"
strTable += "<td>" + entry.EntryType.ToString + "</td>"
strTable += "<td>" + entry.Message + "</td>"
strTable += "</tr>"
x += 1
End If
If x > 100 Then Exit For 'could be 1000s in the log
Next
strTable += "</table>"
End If
As you've noticed, "Source" is NOT one of the LogEntry properties.
Instead the word "Source" is just text trapped inside of the larger Message property. So, to get the "Source" information you're going to have to parse it out of the Message. Split the message into lines. Then loop over the lines and do something when you find a line containing the word "Source"
This code is NOT tested. But, just to give the idea..
Dim messageLines As String() = Nothing
messageLines = entry.Message.Split(Environment.NewLine)
Dim line As String
For Each line In messageLines
If line.Contains("Source") Then
'your code here
Next line
SSIS packages can log to many destinations. And yes, logging to the Windows Event log is an option, but I've seldom seen it used in practice. Windows Event Logs aren't permanent. By default, they are going to start trimming the history once they get over twenty megabytes in size. They are a bad place to store SSIS log information for troubleshooting.
Would you consider gently suggesting to your package authors that they use SSIS SQL logging instead? If they logged to SQL then you'd have the information you need arranged, and stored in a nice searchable manner that would allow for easier querying, aggregation, and analysis across your entire organization. You'd even have the source column you could use to get the exact info you need.
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.
I have a website that was written in VBSCRIPT that I am moving over to VB.NET. Until I have time to get to rewriting some pages/applications, I would like to update some of the code so they work a bit better. I am trying to grab a server variable on the VBSCRIPT page that contains our username from the enterprise login.
I have 2 test pages here, one with language="VB" at the top and the other language="VBSCRIPT".
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Server Variables</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<%
For Each var In Request.ServerVariables
Response.Write("<b>" + var + "</b>= " + Request.ServerVariables(var) + "<br />")
Next
%>
</div>
</form>
</body>
</html>
The VBSCRIPT page will list variables with no data when they have data on the VB page and in ALL_HTTP. Is there any way I can get VBSCRIPT to gather the correct info for all the server variables?
Thank You
EDIT: These are the variables that vary between VB and VBS
AUTH_USER, REMOTE_USER - logged in user on VBS, iis_anon on VB
REMOTE_PORT - not listed in VBS
The following are listed in VBS, but have no data
HTTP_SERVER_PROTOCOL
HTTP_SM_TRANSACTIONID
HTTP_SM_CLIENT_IP
HTTP_REQUEST_METHOD
HTTP_SM_SDOMAIN
HTTP_SM_REALM
HTTP_SM_REALMOID
HTTP_SM_AUTHTYPE
HTTP_SM_AUTHREASON
HTTP_SM_UNIVERSALID
HTTP_SM_AUTHDIROID
HTTP_SM_AUTHDIRNAME
HTTP_SM_AUTHDIRSERVER
HTTP_SM_AUTHDIRNAMESPACE
HTTP_SM_USER
HTTP_SM_USERDN
HTTP_SM_SERVERSESSIONID
HTTP_SM_SERVERSESSIONSPEC
HTTP_SM_TIMETOEXPIRE
HTTP_SM_SERVERIDENTITYSPEC
HTTP_REMOTE_USER
Also there is a custom on I wish to get that is used for our enterprise authentication.
I've had this issue before with custom HTTP headers that have underscores in the raw header name (which can be seen in the ALL_RAW server variable). The HTTP_ converts underscores to dashes (e.g., HTTP_USER_AGENT corresponds to an actual header called User-Agent). In order to retrieve the values of any headers that have underscores in their names, you have to use the HEADER_ prefix, which will search for the exact header name (e.g., HEADER_USER_AGENT will search for a header called User_Agent).
By the way, this blog post offers some more background information on why there are two prefixes.
here a classic ASP page i have running on various IIS versions.
For the user, i have this in most of my projects which makes userinfo available on the server and client side. If you are on a domain replace DMAIN with yours, otherwise you can drop the replace.
NTLM security has to be enabled (windows authentication) on your IIS site, no anonymous access.
The list of servarvariables returned by this code is different depending on OS and IIS versions, enabled features, settings etc. Some keys will have empty values, so eg REMOTE_PORT is not avaiable on mine (i use the standard 80 port) but SERVER_PORT is.
<%
Dim user
user = Replace(uCase(Request.ServerVariables("AUTH_USER")), "DOMAIN\", "")
%>
<script type="text/javascript">var user = <%=user%></script>
Here the contents of servervariables.asp
<html>
<%#language=VBScript%>
<%
With Response
.Expires=-1
.Clear
End With
dim teller
response.write "<h1>Servervariables</h1>"
response.write "<table>"
teller = 1
for each subkey in Request.Servervariables
response.write "<tr><td>"
response.write teller
response.write "</td><td>"
response.write (Request.Servervariables.Key(teller))
response.write "</td><td>"
response.write (Request.Servervariables.Item(teller))
response.write "</td></tr>"
teller = teller + 1
next
response.write "</table>"
response.write request.servervariables("path_translated") & "<br>"
response.write "USER cookie:" & Request.Cookies("USER") & "<br>"
response.write "USER Sessionvariable:" & Session("USER") & "<br>"
%>
</html>
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
I am relatively new to this whole ASP classic programming thing, and I am not working on a pretty complex script. Essentially the script creates a domain user account, and then creates their home folder on a networked machine. I.E: \SERVER\DIR\HOMEDIR.
I have the code working marvelously, except when it comes to making their home directory. It creates the folder, yet it gets and access denied error when it comes to the permissions change. I even have another code that will move the folder and its contents from one directory to another. I have done everything I can think of, the IUSR_MACHINE account even is a domain administrator.
The code is below. Does anyone have any suggestions? Any help would be greately appreciated!
The strHomeFolder is of the form: \SERVER\DIR\DIR with two backslashes at the beginning. I have also tried this on the local server with a local path (C:\DIR\DIR) but that did not work either, same access denied.
Thank you,
Levi
Sub HomeDir()
%>
<br/>
Inside of Homedir()<br/>
<%
strHomeFolder = strHome & strUser
Set objFSO = server.CreateObject("Scripting.FileSystemObject")
Set objShell = server.CreateObject("Wscript.Shell")
If strHomeFolder <> "" Then
If Not objFSO.FolderExists(strHomeFolder) Then
On Error Resume Next
objFSO.CreateFolder strHomeFolder
If Err.Number <> 0 Then
'On Error GoTo 0
'Wscript.Echo "Cannot create: " & strHomeFolder
End If
'On Error GoTo 0
End If
On Error Resume Next
If objFSO.FolderExists(strHomeFolder) Then
%>
<br/>
folder exists<br/>
strHomeFolder = <%=strHomeFolder%><br/>
strUser = <%=strUser%><br/>
<%
'Assign user permission to home folder.
cmdtxt = "%COMSPEC% /c Echo Y| cacls " & strHomeFolder & " /t /c /g Administrators:F " & "SYSTEM:F engineering2\" & strUser & ":F"
intRunError = 25
intRunError = objShell.run(cmdtxt, 2, True)
%>
<br/>
intRunError = <%=intRunError%><br/>
<%
If intRunError <> 0 Then
%>
<br/>
Calcs is balking.......intRunError = <%=intRunError%><br/>
<%
'Wscript.Echo "Error assigning permissions for user " _
'& strUser & " to home folder " & strHomeFolder
End If
End If
End If
Set objFSO = Nothing
Set objShell = Nothing
End Sub
have you given the DIR folder read/write access? this needs to be done on local and the server. Have you checked that permission?
Caio