0

I have recently returned to .net programming after a 7 year break.

I need to learn how to write a project within an existing open source asp.net mvc 5 ecommerce solution to receive posted json strings from a remote server running php with cURL, send acknowledgement responses, create my own json strings to post back to the remote server and receive acknowledgement responses. This must all be done with server side code, with no client side component whatsoever.

Serializing and deserializing json is not the issue, its using the correct kind of pages or services to send and receive json on the server without any client component, and using http objects directly. I have no experience or knowledge of creating this kind of project.

This is my question: I have had a look at a couple of tutorials about using .ashx and httpClient and httpContext but found them a little confusing. I would like to find a comprehensive guide about how to use json to communicate server to server with realistic examples. Is there one available?

2 Answers 2

1

Sounds like a perfect use case for WebApi. It is made specifically to work with JSON (or XML) requests and should work fine with requests issued by other scripts (not browsers).

There are plenty of tutorials available. Here is the official introduction tutorial.

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

1 Comment

Thanks. Once I have read some documentation, I will mark this as the right answer if .net web api turns out to be the correct solution.
0

What I often do to create JSON in C# is make an object/class which I serialize to JSON. My controller has an function:

public JsonResult FunctionName()
{
    var json = new { x1 = 10, y1 = "Hello" };
    return Json(json);
}

You can call that function with PHP.

Comments

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.