Web applications are more vulnerable to security risks.Browsers impose some restrictions to make web applications secure.One such security measure is called same origin policy.Same origin policy prevents a web page to make AJAX requests to different domain. This means the web page in the following website http://www.SampleSite1.com/ can not make ajax requests to http://www.SampleSite2.com/ Same origin policy […]
Archives for September 2016
Content Negotiation in HTTP
Client such as web browser requests a resource (such as HTML document)at a specific URL.In response ,server returns the resource at the requested URL to the client.When the server returns the resource at the requested URL ,it choses a specific representation of the resource such as HTML. Different client may need different representations of the […]
IHttpActionResult in WebAPI
IHttpActionResult is an interface which was introduced in WebAPI 2.It is used to create HttpResponseMessage which is one of the return types in WebAPI. Use of IHttpActionResult Using IHttpActionResult to return HttpResponseMessage object instead of directly returning the HttpResponseMessage object has the following advantages: Since we return an interface from the action method ,it makes it easier to unit […]
Media Formatters in ASP.NET Web API
Media Type or MIME type specifies the data being transfered between the client and server in HTTP request or response. The MIME type for image is image/png.So if the MIME type is specified as image/png for Content-Type of the response then the client will know that the response is an image and will render it […]
Routing in WebAPI
Routing in WebAPI is very similar to routing in MVC. In MVC application routing maps a URL to action methods in Controller.Similarly in WebAPI routing is used to map a URL to action method in Controller. In a WebAPI project routing is defined in the file WebApiConfig.cs in the App_Start folder.By default following route is defined in the WebApiConfig […]