asp.netmime-typeshttp-status-code-406http-accept-header

How can i make the page accept the mimetype in asp.net


I have my own webshop set up with a payment provider and to finalize the buy they send me a post to a page with some data for me to acknowledge the order.

The problem is that when they do the request it returns a 406 error for them. This is what i could find in the logs

The request was rejected because it contained an Accept header for a MIME type that is not supported for the requested file extension.

Content-Type: application/json
Connection: keep-alive
Content-Type: text/plain;charset=UTF-8

What do i need to do for this post not get rejected in asp.net. I am using a global.asax for routing purposes. I have added the mimetype in web.config as so

<mimeMap fileExtension=".json" mimeType="application/json" />

But i figure that doesnt make it an acceptable headertype?

EDIT This is the post they send

connection  close
accept-encoding gzip,deflate
user-agent  Apache-HttpClient/4.5.7 (Java/11.0.13)
host    webhook.site
content-length  2
request-timeout 6300
klarna-client-timeout   6300
klarna-idempotency-key  xxx
klarna-originator-user  
klarna-originator-source    
klarna-correlation-id   xxx
content-type    application/json;charset=UTF-8

Solution

  • I found my solution.

    It seems as my webserver has a blacklist of user-agents. They think the POST has a "to generic" user-agent. Witch caused it to return a 406 error.