InterviewSolution
Saved Bookmarks
| 1. |
Can we Return View from ASP.NET Web API Method? |
|
Answer» Most of the people give the wrong answer for this question. The right answer is No, we can’t. Web API does not RETURN View but returns the data. As we discussed in an earlier interview question about the difference between ASP.NET MVC and Web API, ASP.NET Web API creates HTTP SERVICES that render raw data. Although, it’s QUITE possible in ASP.NET MVC application, the APIController is meant for returning the data. So, if you need to return a view from the controller class, then make sure to use or inherit the Controller class. |
|