none
Lost access to HTTP Request after upgrade to .NET Framework 4.5

    Question

  • I have a WCF service that accepts a POST request from jqGrid in the form of HTML form and returns JSON.

    While things were on .NET 4.0, all worked fine. I could access form fields inside the service via request["fieldName"]. Once I upgraded to .NET 4.5, all my request["fieldName"] are now blank.  Is there some kind of known issue with .NET 4.5, WCF and HttpContext.Current.Request?

    Here is an example:

         POST http://{REMOVED}/Grid.svc/Execute HTTP/1.1
         Accept: application/json, text/javascript, */*; q=0.01
         X-Requested-With: XMLHttpRequest
         Content-Type: application/x-www-form-urlencoded; charset=UTF-8
         Accept-Encoding: gzip, deflate

         _search=false&nd=1355782305975&rows=15&page=1&sidx=modified&sord=desc&search=&category=all

    and, here is the service:

        [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
        public class GridAccess
        {
    [OperationContract]
            [WebInvoke(Method = "POST",
                   BodyStyle = WebMessageBodyStyle.Bare,
                   ResponseFormat = WebMessageFormat.Json,
                   RequestFormat = WebMessageFormat.Json
            )]
            public GridResponse Execute()
            {
                var request = System.Web.HttpContext.Current.Request;

    All references to request["fieldName"] worked before under .NET 4.0 and now, after upgrade to .NET 4.5, they return NULLs.

    Thanks for your help.
    Tuesday, December 18, 2012 12:10 AM

Answers