GetResponse Method Equivalent Required

1 posts, 0 answers
  1. Ash
    Ash avatar
    1 posts
    Member since:
    Aug 2012

    Posted 13 Aug 2012 Link to this post

    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:

    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 = "";
            public Form1()
            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.");
                    string s = Web(url);
            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
                string f = sf.ToString();
                return (f);

    Thanks in advance
Back to Top