Is MVC in Text Mode?

This thread is now closed to new comments.
Some of the links and information provided in this thread may no longer be available or relevant.
If you have a question please start a new post.
CodeMaker
Contributing User
6 Posts
Contributing User
Contributing User

6Posts

0Kudos

1Solutions

Solved: Go to Solution

Is MVC in Text Mode?

I've taken the following piece of code from the MYOBApiCSharp CompanyFilesForm.cs sample and tried to apply it to my MVC C# code.

 

_configurationLocal = new ApiConfiguration(LocalApiUrl);
var cfsLocal = new CompanyFileService(_configurationLocal);
cfsLocal.GetRange(OnComplete, OnError);

 

Fortunately I'm able to send my key and secret to myob and get the required token, send them again so that I retrieve the authoriation code.

 

I no longer get the 'Bad Request' message, so I feel I'm on the right track, but now, when I get to the GetRange() function, I get the following error:

 

'Unexpected character encountered while parsing value: <. Path '', line 0, position 0.'

Because the first charater read is a < (less than) it's as if the CompanyFileService class is returning in "application/text" format, with XML, and GetRange is expecting "application/json".

I've tried converting to a WebApi application however I still have the same result.  also uder result

Is there a way to make MVC C# tell CompanyFileService() to stick to Json?   Or am I way off track?

A working MVC C# sample would be appreciated.

Thank you in advance

1 REPLY 1
CodeMaker
Contributing User
6 Posts
Contributing User
Contributing User

6Posts

0Kudos

1Solutions

Accepted Solution Solved

Re: Is MVC in Text Mode?

Ok, I fixed it.   I rebuilt my application using WebApi.

Didn't find your answer here?

Try using advanced search to find a post more easily Advanced Search
or
Get the conversation started and make a new post Start a Post