Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2014
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. public class Application
  2. {
  3. // This is the main entry point of the application.
  4. static void Main (string[] args)
  5. {
  6. // Create a request for the URL.
  7. WebRequest request = WebRequest.Create (
  8. "http://10.190.80.248/WebService/webservice.asmx/getStudentID?id=1");
  9. // If required by the server, set the credentials.
  10. request.ContentType = "application/json";
  11. request.Credentials = CredentialCache.DefaultCredentials;
  12. // Get the response.
  13. WebResponse response = request.GetResponse ();
  14. // Display the status.
  15. Console.WriteLine (((HttpWebResponse)response).StatusDescription);
  16. // Get the stream containing content returned by the server.
  17. Stream dataStream = response.GetResponseStream ();
  18. // Open the stream using a StreamReader for easy access.
  19. StreamReader reader = new StreamReader (dataStream);
  20. // Read the content.
  21. string responseFromServer = reader.ReadToEnd ();
  22. // Display the content.
  23. Console.WriteLine (responseFromServer);
  24. // Clean up the streams and the response.
  25.  
  26.  
  27. // if you want to use a different Application Delegate class from "AppDelegate"
  28. // you can specify it here.
  29. UIApplication.Main (args, null, "AppDelegate");
  30.  
  31.  
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement