1

I am creating a url in my asp.net mvc application, that will receive sms from clients and process the sms and send response back to the user. My URL looks somewhat like this

http://mydomain.com/mycont/processsms/003365478555?body=mysms

The URL will send back the response like "Success", "Error" etc

Now my question is should a go for apicontroller or normal controller. or there is other better option available to do that

Zia
  • 473
  • 1
  • 4
  • 17

2 Answers2

2

Since the url behaves like an HTTP service, Web API controller (controler inherited from ApiController) is definitely the way to go.

Nishanth Nair
  • 2,975
  • 2
  • 19
  • 22
1

We usually Use Controller to render your normal views. ApiController action only return data that is serialized and sent to the client. Hence in your case where you just have to pass the message it is recomonded you should use API Controller.

Technical Specification

If you have worked with ASP.NET MVC, then you are already familiar with controllers. They work similarly in Web API, but controllers in Web API derive from the ApiController class instead of Controller class. The first major difference you will notice is that actions on Web API controllers do not return views, they return data.

Ref

Community
  • 1
  • 1
K D
  • 5,889
  • 1
  • 23
  • 35