Web developers wiki ASP.NET Sitecore Sharepoint Kentico by Evident Interactive



Windows live search offers free back-end search using a webservice. This is very simple when using Visual Studio.

All you need is an API key from dev.live.com/livesearch

In the project you need to add a webreference to http://soap.search.msn.com/webservices.asmx?wsdl

Example code (the minimal set of code).

C#:
private void Search(string text)
{
    SearchRequest request = new SearchRequest();
    request.Query = string.Format("site:{0} {1}", Request.Url.Host, text);
    request.Requests = new SourceRequest[] 
    { 
        new SourceRequest() 
        { 
            Source = SourceType.Web, 
            Offset = 0, 
            Count = 10 
        } 
    };
    request.AppID = "xxxxxxxxxxxxxx"; // Your AppId here
    request.CultureInfo = System.Threading.Thread.CurrentThread.CurrentUICulture.ToString();

SearchResponse response = new MSNSearchService().Search(request);

if (response != null) { // Now for example bind the search result to a listview control SearchListView.DataSource = response.Responses[0].Results; SearchListView.DataBind(); } }

 © Evident Interactive BV