public HttpResponseMessage Get(string id) { if (String.IsNullOrEmpty(id)) { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } else { id = _browserService.DecodeString(id); HttpResponseMessage response = new HttpResponseMessage(); response.Content = _browserService.GetContent(id); if (id.EndsWith("pdf")) { response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/pdf"); } if (id.EndsWith("doc")) { response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/msword"); response.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("inline"); } return(response); } }