Iris Noida Interview Questions
A c# Asp.NET , MVC based interview
Which jquery selectors have you used ? http://www.w3schools.com/jquery/jquery_ref_selectors.asp
Difference in Api Controller and MVC controller ? http://stackoverflow.com/questions/9494966/difference-between-apicontroller-and-controller-in-asp-net-mvc
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.
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();
For example if your list is like:
List<string> list = new List<string>();
and you specify Accept: application/xml the output will be:
<ArrayOfstring xmlns:i=”http://www.w3.org/2001/XMLSchema-instance” xmlns=”http://schemas.microsoft.com/2003/10/Serialization/Arrays”>
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 ? http://stackoverflow.com/questions/1357118/event-preventdefault-vs-return-false
Jquery makes sure that document is fully loaded ?
Explain MVC filters and attributes. http://www.dotnet-tricks.com/Tutorial/mvc/b11a280114-Understanding-ASP.NET-MVC-Filters-and-Attributes.html
Using tempdata while sessionstate is Off http://stackoverflow.com/questions/10772773/using-tempdata-while-sessionstate-mode-off
Tempdata keep() vs peek() http://stackoverflow.com/questions/21252888/tempdata-keep-vs-peek
How to persist data with TempData . http://www.dotnet-tricks.com/Tutorial/mvc/P81S250214-Persisting-Data-with-TempData.html
Viewdata vs viewbag vs tempdata vs session http://www.dotnet-tricks.com/Tutorial/mvc/9KHW190712-ViewData-vs-ViewBag-vs-TempData-vs-Session.html
Model binding in mvc ? http://www.c-sharpcorner.com/UploadFile/4b0136/introduction-to-model-binding-in-Asp-Net-mvc/
How to initialize mvc controlllers ? http://stackoverflow.com/questions/1679405/system-web-mvc-controller-initialize
Mvc pipeline in asp.net ? http://www.c-sharpcorner.com/UploadFile/0ef46a/mvc-architecture-and-pipeline-in-Asp-Net/
Advantage of attribute based routing in mvc ? http://www.c-sharpcorner.com/UploadFile/bhushangawale/attribute-based-routing-in-Asp-Net-mvc-5/
How does routing in asp.net 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.
- 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 ?
Resolving technical problems:
Solve your technical problems instantly
We provide Remote Technical Support from Monday to Sunday, 7:00PM to 1:00 AM
Mail your problem details at email@example.com along with your mobile numberand we will give you a call for further details. We usually attend your problems within 60 minutes and solve it in maximum 2 days.