Iris Noida Interview Questions

Iris Noida Interview Questions

A c# Asp.NET , MVC based interview

What is the difference between an interface and abstract class?

Which jquery selectors have you used ?

CTE vs  temp tables ?

Difference in Api Controller and MVC controller ?

What changes are required for webapi to return xml ?

If you don’t want the controller to decide the return object type, you should set your method return type as System.Net.Http.HttpResponseMessage and use the below code to return the XML.

public HttpResponseMessage Authenticate()


//process the request


string XML=”<note><body>Message content</body></note>”;

return new HttpResponseMessage()


Content = new StringContent(XML, Encoding.UTF8, “application/xml”)



This is the quickest way to always return XML from Web API.

You should simply return your object, and shouldn’t be concerned about whether its XML or JSON. It is the client responsibility to request JSON or XML from the web api. For example, If you make a call using Internet explorer then the default format requested will be Json and the Web API will return Json. But if you make the request through google chrome, the default request format is XML and you will get XML back.

If you make a request using Fiddler then you can specify the Accept header to be either Json or XML.

Accept: application/xml


Simple return list of string, instead of converting it to XML. try it using Fiddler.

public List<string> Get(int tenantID, string dataType, string ActionName)


List<string> SQLResult = MyWebSite_DataProvidor.DB.spReturnXMLData(“SELECT * FROM vwContactListing FOR XML AUTO, ELEMENTS”).ToList();

return SQLResult;


For example if your list is like:

List<string> list = new List<string>();




return list;

and you specify Accept: application/xml the output will be:

<ArrayOfstring xmlns:i=”” xmlns=””>





and if you specify ‘Accept: application/json’ in the request then the output will be:






So let the client request the content type, instead of you sending the customized xml.

Event.preventDefault vs false ?

Jquery makes sure that document is fully loaded ?

Explain MVC filters and attributes.

Using tempdata while sessionstate is Off

Tempdata keep() vs peek()

How to persist data with TempData .

Viewdata vs viewbag vs tempdata vs session

Model binding in mvc ?

How to initialize mvc controlllers ?

Mvc pipeline in ?

Advantage  of attribute based routing in mvc ?

How does routing in mvc takes place ?

=== operator in js ??

Note 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.

But having a REST-ful API is such a common requirement today that WebAPI was created to simplify the implementation of a such an API.

It’s fairly simple to decide between the two: if you’re writing an HTML based web/internet/intranet application – maybe with the occasional AJAX call returning json here and there – stick with MVC/Controller. If you want to provide a data driven/REST-ful interface to a system, go with WebAPI. You can combine both, of course, having an ApiController cater AJAX calls from an MVC page.

MVC provides with:

  • Content negotiation : Content negotiation makes adding that across an entire API relatively simple with Web API, but it would be cumbersome to update a plethora of MVC controller actions.
  • Flexibility
  • Separation of concerns

Viewbad vs session vs tempdata -à how are they different ?

Union vs union all in SQL server ?

Rank vs Dense Rank ?

Routing — mapping, is all mapping required to be mentioned for every routing ?

What is Actionresult ?

View vs partial view ?

What are mvc filter constraints ?

Explain attribute based routing ?


Leave a Reply

Your email address will not be published. Required fields are marked *