Powered by Blogger.

Saturday, March 1, 2014

HTTP-GET in Asp.Net

The use of HTTP-GET has been rather popular for quite awhile. It enables you to send your entire request, along with any required parameter, all contained with in the URL submission.

Here is an example of a URL request that is passing a parameter to the server that will respond.


In this example, a request from the AspDotNetHelp.com website is made, but in addition to a typical web request, it is also passing along a parameter. Any parameters that are sent along using HTTP-GET can only be in a name /value pair construction-also known as query strings. This means that you can have only a single value assigned to a single parameter. You can't provide hierarchical structures through query strings. As you can tell from the previous URL construction, the name/value pair is attached to the URL by ending the URL string with a question mark, followed by the variable  name.
Using query strings, you can also pass more than a single name/value pair with the URL request as the following example shows:


In this example, the URL construction includes two name/value pairs.The name /value pairs are separated with an ampersand(&).

Now turn your attention to working with the addition web service using the HTTP-GET . To accomplish this task, you must enable HTTP-GET from within the web service application because it is disabled by default.

Enabling HTTP-GET in your web service applications

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<add name="HTTP-GET"/>

Creating the <protocols> section in your web.config file enables you to add or remove protocol communications.