in Education by
I got to Download the read the content of this webpage i am using this code it is for a windows phone app string html = new StreamReader(Application.GetResourceStream(new Uri("http://www.knbsb.nl/nw/index.php?option=com_content&view=category&layout=blog&id=382&Itemid=150&lang=nl&LevelID=120&CompID=1580", UriKind.Relative)).Stream).ReadToEnd(); I know that the UriKind is set Relative, but it has to be for the other script. So basically i have to make the webpage to a relative Urikind from a absolute Uri. But I don't know how to do that! JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
You need to make the request asynchronously. You can use something like this as a helper: public static void RequestAsync(Uri url, Action callback) { if (callback == null) { throw new ArgumentNullException("callback"); } try { var req = WebRequest.CreateHttp(url); AsyncCallback getTheResponse = ar => { try { string responseString; var request = (HttpWebRequest)ar.AsyncState; using (var resp = (HttpWebResponse)request.EndGetResponse(ar)) { using (var streamResponse = resp.GetResponseStream()) { using (var streamRead = new StreamReader(streamResponse)) { responseString = streamRead.ReadToEnd(); } } } callback(responseString, null); } catch (Exception ex) { callback(null, ex); } }; req.BeginGetResponse(getTheResponse, req); } catch (Exception ex) { callback(null, ex); } } You can then make calls like this: private void Button_Click(object sender, RoutedEventArgs e) { RequestAsync( new Uri("http://www.knbsb.nl/nw/index.php?option=com_content&view=category&layout=blog&id=382&Itemid=150&lang=nl&LevelID=120&CompID=1580"), (html, exc) => { if (exc == null) { Dispatcher.BeginInvoke(() => MessageBox.Show(html)); } else { // handle exception appropriately } }); }

Related questions

0 votes
    I am trying to extract data from below URL using UIPathhttps://www.marketwatch.com/tools/stockresearch/globalmarkets/ ... 5 Datatables? Select the correct answer from above options...
asked Feb 1, 2022 in Education by JackTerrance
0 votes
    Hi Folks i was googling one more hours.i did not find anything relevant, I have text File like ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 14, 2022 in Education by JackTerrance
0 votes
    If I am trying to determine the read speed of a drive, I can code a routine to write files to a ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 20, 2022 in Education by JackTerrance
0 votes
    In Android Q the field MediaStore.Files.FileColumns.DATA has been deprecated, and may be Null or apps have ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    Pulling my hair out here. All was working fine, and then out of the blue, I started to get some ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 21, 2022 in Education by JackTerrance
0 votes
    I'm currently using Cloud Firestore as my backend for a mobile app. I've got basic payments working ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 19, 2022 in Education by JackTerrance
0 votes
    I want to download videos from a website. Here is my code. Every time when i run this code, it ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    I am trying to build a mailto: uri to send a mail using the GMail app. I would like to use the ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    When I attempt to load data into BigQuery from Google Cloud Storage it asks for the Google Cloud Storage URI ... Developers Console? Select the correct answer from above options...
asked Feb 2, 2022 in Education by JackTerrance
0 votes
    Learning RPA with UIPath. Happily extracting onscreen data from a website, processing it, using it, etc. However, ... this stage :/ Select the correct answer from above options...
asked Feb 1, 2022 in Education by JackTerrance
0 votes
    If we want to add a glyphicon to our webpage, what is the minimum number of classes the element should have? Select the correct answer from above options...
asked Dec 29, 2021 in Education by JackTerrance
0 votes
    The Function Key F5 is used in a webpage to___________the page (a) Exit (b) Create another window (c) Reload (d) Add a new tab Select the correct answer from above options...
asked Dec 24, 2021 in Education by JackTerrance
0 votes
    Php script to modify a webpage data and save it as another webpage Select the correct answer from above options...
asked Dec 20, 2021 in Education by JackTerrance
0 votes
    1. Create a webpage using the following tags: , , , , Rs 1000 Rs 750, , Select the correct answer from above options...
asked Dec 17, 2021 in Education by JackTerrance
0 votes
    without mentioning which of the following for browser to find and display an image? (a) source of the image (b) ... none of the given Select the correct answer from above options...
asked Dec 15, 2021 in Education by JackTerrance
...