This question is locked. New answers and comments are not allowed.
Hi friends,
im new to telerik but very old to .net C#
im having this trouble from last 24hrs or more please help me out
this is the code working perfectly in .net framework 4 but getResponse method is not working in silverlight telerik
i tried many alternatives like web client & getresponsestream but it just didnt worked
please provide an alternative for GetResponse Method
Heres the Code:
Thanks in advance
im new to telerik but very old to .net C#
im having this trouble from last 24hrs or more please help me out
this is the code working perfectly in .net framework 4 but getResponse method is not working in silverlight telerik
i tried many alternatives like web client & getresponsestream but it just didnt worked
please provide an alternative for GetResponse Method
Heres the Code:
using System;using System.Collections.Generic;using System.Linq;using System.Net;using System.Net.Browser;using System.Drawing;using System.Windows;using HtmlAgilityPack;using System.IO;using System.Text;using System.Xml;using System.Windows.Controls;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Animation;using System.Windows.Shapes;namespace WebSample2{ public partial class Form1 : Form { string url = "http://sports.yahoo.com/olympics/united-states/"; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { HttpWebRequest request = null; request = HttpWebRequest.Create(url) as HttpWebRequest; request.Method = "GET"; // Supports POST too HttpWebResponse response = request.GetResponse() as HttpWebResponse; if (response == null || response.StatusCode != HttpStatusCode.OK) { MessageBox.Show("Site is Down"); } else if (request.Method != "GET") { MessageBox.Show("Website does not support GET Method."); } else { string s = Web(url); MessageBox.Show(response.Method.ToString()); MessageBox.Show(s); } } private string Web(string web) { // The HtmlWeb class is a utility class to get the HTML over HTTP HtmlWeb htmlWeb = new HtmlWeb(); // Creates an HtmlDocument object from an URL HtmlAgilityPack.HtmlDocument document = htmlWeb.Load(web); StringBuilder sf = new StringBuilder(); foreach (HtmlAgilityPack.HtmlTextNode node in document.DocumentNode.SelectNodes("//li[@class='total']/em/text()")) { sf.Append(node.Text.Trim()); break; } string f = sf.ToString(); return (f); } }}Thanks in advance