Click here to Skip to main content
15,884,947 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
im creating a metro style app and i need to get response from internet resource

in win form app:
C#
 // Create the web request  
HttpWebRequest request = WebRequest.Create("https://abc.com/") as HttpWebRequest;

// Get response
   using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)


but in Metro style app request dont have GetResponse() method

Thanks.
Posted
Updated 31-Aug-12 22:15pm
v2

C#
using System.Net;

//Web Request
HttpWebRequest Imgrequest = (HttpWebRequest)WebRequest.Create("web address");
NetworkCredential credential = new NetworkCredential("username", "password", "domain");
Imgrequest.Credentials = credential; //If authentication required for the web address

//Web Response
HttpWebResponse webresponse = (HttpWebResponse)await Imgrequest.GetResponseAsync();
var stream = webresponse.GetResponseStream();


Thanks,
Bilaal
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900