2

I have this Web API function that I wish to use to return errors if any invalid data is passed in. I do this by using the Request.CreateResponse function, and passing it the error code and list of errors.

public HttpResponseMessage Post([FromBody]Lead leadToCreate)
    {
           // Code to validate the request, and populate errorList which is a List<Error> goes here        

            if (errorList.Count > 0)
            {
                // Return list of errors and 304 code
                return Request.CreateResponse(HttpStatusCode.NotModified, errorList);
            }
            else
            {
                //Validated successfully.
                return Request.CreateResponse(HttpStatusCode.Created);
            }

   }

The Error class is:

public class Error
{
    public int number;
    public string description;
    public string url;
}

When I make a POST request with Fiddler on localhost, the error list is output as part of the JSON response (see the last line):

HTTP/1.1 304 Not Modified

Cache-Control: no-cache

Pragma: no-cache

Content-Type: application/json; charset=utf-8

Expires: -1

Server: Microsoft-IIS/10.0

X-AspNet-Version: 4.0.30319

X-SourceFiles: =?UTF-8?B?QzpcU291cmNlIENvZGVcV2ViXEZhc3R0cmFjayBBUElcRmFzdHRyYWNrIEFQSVxhcGlcc2FsZXNFbnF1aXJ5XDFc?=

X-Powered-By: ASP.NET

Date: Wed, 10 Feb 2016 14:49:20 GMT

[{"number":1,"description":"PrivateIndividual.Gender must be valid.","url":""}]

My problem is that after publishing to my live server, the error list isn't output despite using the same request data, although the correct response code is returned:

HTTP/1.1 304 Not Modified

Cache-Control: no-cache Pragma: no-cache Content-Type: application/json; charset=utf-8

Expires: -1 Server: Microsoft-IIS/7.0

X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET Date: Wed, 10 Feb

2016 14:52:13 GMT Connection: close X-ScanSafe-Error: F284 Via:

HTTP/1.1 proxy10012

Can anyone see why this may be working fine on localhost, but not my live server?

1 Answer 1

2

It looks like there is an application layer proxy having a problem with the response:

2016 14:52:13 GMT Connection: close X-ScanSafe-Error: F284 Via:

HTTP/1.1 proxy10012

And it looks like this proxy is blocking the HttpResponse from getting back to fiddler.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you! I logged off my office's network, used my phone as a hot spot and tried the request again and it worked perfectly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.