6.
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".
7.
Sessions can be maintained in MVC by three ways: tempdata, viewdata, and viewbag.
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