using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.IO;
using System.Xml.Xsl;
using System.Xml;
using System.Text;

namespace CustomLiveSearch
{
    public partial class _Default : System.Web.UI.Page
    {
        private const string SEARCH_URL = "http://api.search.live.net/xml.aspx?AppId={0}&Market={1}&Query={2}&Sources=web";
        private const string APP_ID = "";


        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            string url = String.Format(SEARCH_URL,
                                        APP_ID,
                                        "cs-CZ",
                                        Uri.EscapeDataString(txtSearch.Text));

            WebRequest request = WebRequest.Create(new Uri(url));
            WebResponse response = request.GetResponse();
            StreamReader data = new StreamReader(response.GetResponseStream());

            xmlTransformace.DocumentContent = data.ReadToEnd();
        }
    }
}
