PDA

View Full Version : Site search with ASP.net


Mhtml
12-12-2002, 10:09 AM
Okey dokes, I have absoloutley no idea if asp.net is capable of grabbing info out of a html page unlike classic, but if it can...

1.Can I have an example?
2.Failing that a link to one?
3.At least a tutorial...


Thanks..

Roy Sinclair
12-12-2002, 06:54 PM
Since the results from Index Server are available via ADO then I don't see any reason why they wouldn't be available to ADO.NET. It shouldn't be that difficult to translate the ASP examples to ASPX.

(At least that's why I think of when you say "Site Search" :) )

BigDaddy
12-13-2002, 10:12 PM
Are you asking if you're able to grab info from any site, such as cnn.com? I don't think so. I believe you need an extra component to request the raw HTML, just as you would with classic ASP.

If what you're asking is checking for specific content on a page on your own server, yes, just open it with the filesystem object and do a search for it using instring() or a regular expression search.

Mhtml
12-14-2002, 02:54 AM
Ok, I've done a little research into site searching and have found 2 soloutions.

1. A freely available class which does the job really quickly but seems unstable.
2.Using index server.

I have almost no idea how to use index server what so everr so can I have a little bit of info please?

angiras
12-14-2002, 07:41 AM
Private Function GetAll() As String

Dim s As String
Dim req As HttpWebRequest
Dim res As HttpWebResponse
Dim r As StreamReader

Dim ex As Exception

req = CType(req.Create(URL), HttpWebRequest)
req.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)"

res = CType(req.GetResponse(), HttpWebResponse)
r = New StreamReader(res.GetResponseStream, var.CodeLangueEurope, True)

s = r.ReadToEnd

r.Close()
res.Close()

Return s

End Function


--------------------------

req.Create(URL) : URL =http://www,anysite.com/anypage.htm

then you have just to look in it with regular expression

Roy Sinclair
12-16-2002, 10:03 PM
Originally posted by Mhtml
Ok, I've done a little research into site searching and have found 2 soloutions.

1. A freely available class which does the job really quickly but seems unstable.
2.Using index server.

I have almost no idea how to use index server what so everr so can I have a little bit of info please?

I posted some already written pages I use for index server a while back in another thread (http://www.codingforums.com/showthread.php?s=&threadid=9196&highlight=index+server).