Authorize.Net 4.0 Plugin Incorrect Content-Type Error

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
The Authorize.Net 4.0 Plugin creates the "Incorrect Content-Type Error" during checkout.

Steps to reproduce error:

1. install and activate the Authorize.Net plugin in Nop 4.0
2. Add items to cart and proceed to checkout (standard checkout, not 1 page)
3. After selecting "credit card" and click next, the next page fails completely.

Error log shows as follows:

Log level: Error
Short message: Incorrect Content-Type:
Full message: System.InvalidOperationException: Incorrect Content-Type:
   at Microsoft.AspNetCore.Http.Features.FormFeature.ReadForm()
   at Microsoft.AspNetCore.Http.Internal.DefaultHttpRequest.get_Form()
   at Nop.Plugin.Payments.AuthorizeNet.Components.AuthorizeNetViewComponent.Invoke()
   at lambda_method(Closure , Object , Object[] )
   at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
   at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvoker.InvokeSyncCore(ObjectMethodExecutor executor, ViewComponentContext context)

The error message is then followed by an extremely long call stack.

Steps to resolve error:
1. Open the \Plugins\Nop.Plugin.Payments.AuthorizeNet\Components\AuthorizeNetViewComponent.cs file
2. On line 44 change
var form = Request.Form;
to
var form = Request.Query;

3. Rebuild and re-deploy the plugin
5 years ago
Done. Please see https://github.com/nopSolutions/Authorize.Net-plugin-for-nopcommerce/commit/e133a8e8a11928fe692431a80edc686d8df266a7
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.