Win Surprise Gifts!!!
Top 5 Contributors of the Month
Post New Question
Subscribe to Forum
HTTP Derivations of Web Request and Web Response
April 25, 2011
Can anybody tell me the HTTP Derivations of Web Request and Web Response.
Posted Date: June 13, 2011 Points: 20
is the abstract base class for the .NET Framework's request/response model for accessing data from the Internet. An application that uses the request/response model can request data from the Internet in a protocol-agnostic manner, in which the application works with instances of the WebRequest class while protocol-specific descendant classes carry out the details of the request.
Requests are sent from an application to a particular URI, such as a Web page on a server. The URI determines the proper descendant class to create from a list of WebRequest descendants registered for the application. WebRequest descendants are typically registered to handle a specific protocol, such as HTTP or FTP, but can be registered to handle a request to a specific server or path on a server.
class is the abstract base class from which protocol-specific response classes are derived. Applications can participate in request and response transactions in a protocol-agnostic manner using instances of the WebResponse class while protocol-specific classes derived from WebResponse carry out the details of the request.
Client applications do not create WebResponse objects directly; they are created by calling the GetResponse method on a WebRequest instance.
public class WebRequestGetExample
public static void Main ()
// Create a request for the URL.
WebRequest request = WebRequest.Create ("http://www.contoso.com/default.html");
// If required by the server, set the credentials.
request.Credentials = CredentialCache.DefaultCredentials;
// Get the response.
HttpWebResponse response = (HttpWebResponse)request.GetResponse ();
// Display the status.
// Get the stream containing content returned by the server.
Stream dataStream = response.GetResponseStream ();
// Open the stream using a StreamReader for easy access.
StreamReader reader = new StreamReader (dataStream);
// Read the content.
string responseFromServer = reader.ReadToEnd ();
// Display the content.
// Cleanup the streams and the response.
To post reply
Related Questions Related Questions
How to pass XML file as request to BizTalk server and get back the response also in XML file?
Difference Between Response.Write and Response.Output.Write?
What's the difference between Response.Write() andResponse.Output.Write()?
what are methods of response object?
what is HTTP Handlers and HTTP Modules
c# Use of Response.End
Edit document remove request parameter
list some disadvantages of using Response.Redirect
What is the difference between Server.Transfer and Response.Redirect
How to set the cookie in a WCF request?
Latest Forum Questions From The Same Category
Window Service C#.net not working properly
C# Onvif IP Camera Viewer NuGet package
Land Registry Business Gateway Webservice - reference the returned XMLDocument
Technology to be used for Finance Application
problem instal net framwork 4
I am looking for Dotnet developer opening in Middle level company.
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more
Quick Links For Forum Categories:
Hall of Fame
Terms of Service
Tell A Friend