What is the difference between "Request" and "Response" terminologies in ASP.net? I am using ASP.net 3.5.
Suppose I have to make somebody understand about these terms. What should i say ?
What is the difference between "Request" and "Response" terminologies in ASP.net? I am using ASP.net 3.5.
Suppose I have to make somebody understand about these terms. What should i say ?
The Request is what a web client sends to the web server. The Response is what the web server sends - well, in response. Both are defined in the HTTP specification. (How they are structured, what information and meta data they include, etc.)
ASP.Net encapsulates these concepts in respective classes to make them programmatically accessible.
Request.QueryString
If you have a URL like the following:
http://www.host.com/Page.aspx?name=Henry&lastName=Ford
The part after the ?
is the query string. (name=Henry&lastName=Ford <= The query string
)
This is one common way to pass arguments to the server as part of the Request. In your server code you can access these arguments by using Request.QueryString
:
string name = Request.QueryString["name"];
string lastName = Request.QueryString["lastName"];
Response.Redirect
Your server received a Request for a page and you want to redirect to another location. With the Response.Redirect()
method, you add a specific piece of information to the Response that causes the browser to immediately go to this other page.
// This tells the browser to load google
Response.Redirect("http://www.google.com");
There is a IIS (Internet Information Services) Server.. In ASP.Net, you can Request for data from the server, and what the server sends you is a Response