how to create search engine for a site.
is there some code is avaliable for that in asp.net .
help its important
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Gomathi PalaniswamyRank #714 · 3.3K reputationPosted Oct 17, 2010, 2:53 AM EDT
first get the page source like
WebRequest Request = WebRequest.Create("URL");
WebResponse Response = Request.GetResponse();
Stream RStream = Response.GetResponseStream();
Encoding en = System.Text.Encoding.GetEncoding("utf-8");
StreamReader read = new StreamReader( RStream, en );
string str=read.ReadToEnd();
and made searches in the str(source page) and display on default page
shilpi gupta44 reputationPosted Oct 17, 2010, 3:13 AM EDT
do i put that code on search button click.
my problem is that
I have created a auction website and I need to have a search engine on master page. When I type 'belt', all the words containing belt should appear. I used a textbox, a button, I type the text I wanna search into the textbox, and click the button. Information will appear on the page
like
i have various item on page. that detail infomation is store in db.(like belt price ,pic, size.colour etc.)
when user type belt.
is move to belt page ---> like that ->home-> men-> accc-> belt
direct. then it show its detail from db
Gomathi PalaniswamyRank #714 · 3.3K reputationPosted Oct 17, 2010, 8:52 PM EDT
Write the below coding in button click event,it will retrieve the web page and write on default page
string MyString = "";
if (TxtBN.Text != "")
{
MyString = TxtBN.Text;
}
else if (TxtAuthor.Text != "")
{
MyString = TxtAuthor.Text;
}
if (MyString != "")
{
string Address = "http://www.stmarksbookshop.com/search/apachesolr_search/" + MyString;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Address);
WebResponse response = null;
StreamReader reader = null;
response = request.GetResponse();
reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
string result = reader.ReadToEnd();
reader.Close();
if (result.Contains("Search results"))
{
int k = result.IndexOf("
int g = result.IndexOf("
string Final = result.Substring(k, g - (k));
string Path = Server.MapPath("~/");
string Code = "<%@ Page Language=\"C#\" MasterPageFile=\"~/MasterPage.master\" AutoEventWireup=\"true\" CodeFile=\"Default.aspx.cs\" Inherits=\"_Default\" Title=\"Search Results\" %>" + "\n" + "
Code = Code + Final + "\n" + "
StreamWriter sr1 = new StreamWriter(Path + "Default.aspx");
sr1.WriteLine(Code);
sr1.Close();
Response.Redirect("Default.aspx");
}
else
{
LblMsg.Text = "No Data Found";
}