Saturday, July 13, 2013

JQuery

http://www.codeproject.com/Articles/618484/Latest-jQuery-interview-questions-and-answers

1.Replace?
$( "div.third" ).replaceWith( $( ".first" ) );
2.How to maintain the sessions in JQuery?
$.session.set("compareLeftContent","value"); alert($.session.get("compareLeftContent"));
2. Jquery vs AngularJS

RestFul API will not support Jquery
MVC pattern support. AngularJS
Twoway data binding
Form validation
Localization

MCV3 Interview questions


http://www.dotnet-tricks.com/Home/MVCInterviewBook

http://www.codeproject.com/Articles/556995/Model-view-controller-MVC-Interview-questions-and#How_to_implement_windows_authentication_for_MVC

http://www.dotnet-tricks.com/Tutorial/mvc/LYHK270114-Detailed-ASP.NET-MVC-Pipeline.html

http://www.codeproject.com/Articles/741228/MVC-Application-Lifecycle

1.Action filters?



  • OutputCache – This action filter caches the output of a controller action for a specified amount of time.
  • HandleError – This action filter handles errors raised when a controller action executes.
  • Authorize – This action filter enables you to restrict access to a particular user or role.

  • The Different Types of Filters

    The ASP.NET MVC framework supports four different types of filters:
    1. Authorization filters – Implements the IAuthorizationFilter attribute.
    2. Action filters – Implements the IActionFilter attribute.
    3. Result filters(response fileters) – Implements the IResultFilter attribute.
    4. Exception filters – Implements the IExceptionFilter attribute.
    2.Advantages of Unity?

    1. It provides simplified object creation, especially for hierarchical object structures and dependencies, which simplifies application code. It contains a mechanism for building (or assembling) instances of objects, which may contain other dependent object instances.
    2. It supports abstraction of requirements; this allows developers to specify dependencies at run time or in configuration and simplify the management of cross-cutting concerns.
    3. It increases flexibility by deferring component configuration to the container. It also supports a hierarchy for containers.
    4. It has a service location capability, which is useful in many scenarios where an application makes repeated use of components that decouple and centralize functionality.
    5. It allows clients to store or cache the container. This is especially useful in ASP.NET Web applications where developers can persist the container in the ASP.NET session or application.
    6. It has an interception capability, which allows developers to add functionality to existing components by creating and using handlers that are executed before a method or property call reaches the target component, and again as the calls returns.
    7. It can read configuration information from standard configuration systems, such as XML files, and use it to configure the container.
    8. It makes no demands on the object class definition. There is no requirement to apply attributes to classes (except when using property or method call injection), and there are no limitations on the class declaration.
    9. It supports custom container extensions that you can implement; for example, you can implement methods to allow additional object construction and container features, such as caching.
    10. It allows architects and developers to more easily implement common design patterns often found in modern applications.


    3.Life cycle of MVC3?




    Request -->Routing --> Handler -->Controller --> Action --> View --> Response

    4.Http module?

    Http handler in asp.net, mvc handler in mvc
    ASP.NET MVC has action filters, while ASP.NET has HTTP modules.

    5.How to deploy the MVC application?

    http://forums.asp.net/t/1748670.aspx?Deploy+MVC+3+application+into+IIS+7

    6.

    Explain attribute based routing in MVC?

    This is a feature introduced in MVC 5. By using the "Route" attribute we can define the URL structure. For example in the below code we have decorated the "GotoAbout" action with the route attribute. The route attribute says that the "GotoAbout" can be invoked using the URL structure "Users/about".
    public class HomeController : Controller
    {
           [Route("Users/about")]
           public ActionResult GotoAbout()
           {
               return View();
           }
    }

    7.

    How can we maintain sessions in MVC?

    Sessions can be maintained in MVC by three ways: tempdata, viewdata, and viewbag.

    8 Restful services?
    RESTful architecture use HTTP for all CRUD operations like (Read/Create/Update/Delete) using simple HTTP verbs like (GET, POST, PUT, and DELETE).It’s simple as well as lightweight. 

    9. difference between mvc3,mvc4 and mvc5?


    10. asp.net and mvc3

    Asp.Net Web Forms
    Asp.Net MVC

    Asp.Net Web Form follow a traditional event driven development model.
    Asp.Net MVC is a lightweight and follow MVC (Model, View, Controller) pattern based development model.

    Asp.Net Web Form has server controls.
    Asp.Net MVC has html helpers.

    Asp.Net Web Form supports view state for state management at client side.
    Asp.Net MVC does not support view state.

    Asp.Net Web Form has file-based URLs means file name exist in the URLs must have its physically existence.
    Asp.Net MVC has route-based URLs means URLs are divided into controllers and actions and moreover it is based on controller not on physical file.

    Asp.Net Web Form follows Web Forms Syntax
    Asp.Net MVC follow customizable syntax (Razor as default)

    In Asp.Net Web Form, Web Forms(ASPX) i.e. views are tightly coupled to Code behind(ASPX.CS) i.e. logic.
    In Asp.Net MVC, Views and logic are kept separately.

    Asp.Net Web Form has Master Pages for consistent look and feels.
    Asp.Net MVC has Layouts for consistent look and feels.

    Asp.Net Web Form has User Controls for code re-usability.
    Asp.Net MVC has Partial Views for code re-usability.

    Asp.Net Web Form has built-in data controls and best for rapid development with powerful data access.
    Asp.Net MVC is lightweight, provide full control over markup and support many features that allow fast & agile development. Hence it is best for developing interactive web application with latest web standards.

    Asp.Net Web Form is not Open Source.
    Asp.Net Web MVC is an Open Source.

    11.Maximum how many parameters we can pass in mvc?
    I suspect that there is no limit on the number of arguments - your main limitation wouild be the maximum HTML request/header lengths imposed by both the browser and server.

    we can change path segment length setting UrlSegmentMaxLength in regedit.

    12. Views and forms in MVC?
    Each view having multiple forms.
    http://stackoverflow.com/questions/15788806/asp-net-mvc-4-multiple-post-via-different-forms

     13 MVC attributes?

    14.Request processing?
    Incoming request->Parse URL->find matching Route->Process request

    15. Server side binding dropdownlist in MVC?

    http://www.c-sharpcorner.com/UploadFile/3d39b4/dropdownlist-in-Asp-Net-mvc/


    @Html.DropDownList("Action", PathToController.GetUsers())
    then on the controller where you want to put this method
    public static List<SelectListItem> GetUsers(){
        List<SelectListItem> ls = new List<SelectListItem>();
        var result = //database call here
        foreach(var temp in result){
            ls.Add(new SelectListItem() { Text = temp.Name, Value = temp.ID });
        }
        return ls;
    }
    16. Overriding the Routing?
     
    public class HomeController : Controller
    {
           [Route("Users/about")]
           public ActionResult Aboutgo()
           {
               ViewBag.Message = "You successfully reached USERS/About route";
               return View();
           }
    }
    17.How many forms we can use in view of mvc?
    Yes we can have multiple forms inside one view.
    
    
    18.What is model ,view and control?
    MVC: View renders the data from model in response to the request made to the model by controlled events made by user interaction.
    Controller :Controller responds to events to command model and view to  change. User interaction triggers the events to change the model, which in turn calls some methods of model to update its state to notify other registered views to refresh their display
    Model is accessible by both controller and view
    Model can be used to pass data from controller to view
    View can be use model to display the data in page.
    View is an ASPX page without having code behind file.
    A request to view can be made only from a controller’s action method
    Controller can access  and use model class to pass data to views
    19.MVC 3 life cycle.
    20.What does Model, View and Controller represent in an MVC application?
    Model: Model represents the application data domain. In short the applications business logic is contained with in the model.
    View: Views represent the user interface, with which the end users interact. In short the all the user interface logic is contained with in the UI.
    Controller: Controller is the component that responds to user actions. Based on the user actions, the respective controller, work with the model, and selects a view to render that displays the user interface. The user input logic is contained with in the controller.
    21.Modal Binding?
    MVC Modal binding allows you to map http request data with a modal.
    MVC runtime uses default model binder to build the parameters
    Model binding implicitely goes to work when you have an action parameter
    Model binding can be explicitely invoke using updatemodel and tryupdatemodel methods