Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

ASP.

NET intro Questions

1. what ASP stands for?

ASP stands for Active Server Pages

2. what is used for ASP?

used for developing web applications and services, is a free and open-source web framework created by
Microsoft.

3. is ASP server-side or front-side?

Server-side (ASP.NET): Handles data processing, business logic, and dynamic content generation.

Front-end (HTML, CSS, JavaScript): Provides the visual layout and interactive elements experienced by
the user.

4. how ASP works through web?

5. list ASP Applications?

Classic ASP

ASP.NET Web Forms

ASP.NET MVC

ASP.NET Web Pages

ASP.NET API

ASP.NET Core

6. what is written in Classic ASP?

Classic ASP pages have the file extension .asp and are normally written in VBScript.

ASP MVC intro Questions

1. when released ASP.NET MVC1?

Released on Mar 13, 2009


2. what are the features of MCV?

Full control over your HTML, JavaScript , and URLs

A new presentation option for ASP.Net

A simpler way to program Asp.Net

Clear separation of logic: Model, View, Controller

Test-Driven Development

Support for parallel development

3. what is the funtion of models?

Model objects are parts of the application which implement the logic for the application’s data domain.

It retrieves and stores model state in a database

4. what is the funtion of views?

Views are the components which are used to display the application’s user interface (UI) also called view
model in MVC. It displays the .Net MVC application’s which is created from the model data.

5. what is the funtion of controllers?

Controllers handle user reguests interaction, work with the model, and select a view to render that
display Ul.

6. what are advantages of ASP.NET MVC?

Highly maintainable applications by default

It allows you to replace any component of the application.

Better support for Test Driven Development

Complex applications are easy to manage because of divisions of Model, View, and Controllers.

7. what re best practices while using ASP.Net MVC

Represents the data and business logi of your application


8. what are actions? state two types of HTTP request that handles by the actions?

Actions are only a spatial types of methods that for writing the code for a specific task and then is also

responsible for returning something to the user and that can be a page/partial page (User Controls).

state two types of HTTP request that handles by the actions?

[HttpGet]

[HttpPost]

9. what are [HttpGet] actions?

actions to handle requests coming directly from the user

10. what are [HttpPost] actions?

actions are only called when there is a previously view on the client-side

Creating First Project Questions

1. list main ASP.NET MVC project structures?

APP_DATA APP_START

CONTENT CONTROLLERS

FONTS MODELS

SCRIPTS VIEWS

Additional folders

Global.asax

Packages.config

Web.config
2. what is uses of App_Data?

The App_Data folder can contain application data files like LocalDB, .mdf files,

3. what is uses of App_Start?

The App_Start folder can contain class files that will be executed when the application starts.

BundleConfig.cs, FilterConfig.cs, RouteConfig.cs

4. what is uses of Content?

The Content folder contains static files like CSS files, images, and icons files.

MVC 5 application includes bootstrap.css, bootstrap.min.css, and Site.css by default.

5. what is uses of Controllers?

The Controllers folder contains class files for the controllers. A Controller handles users' request and
returns a response.

6. what is uses of Fonts?

The Fonts folder contains custom font files for your application.

7. what is uses of Models?

used by the application to hold and manipulate application data

8. what is uses of Scripts?

The Scripts folder contains JavaScript or VBScript files for the application.

9. what is uses of Views?

The Views folder contains HTML files for the application.

10. what is uses of Global.aspx?

Global.aspx file allows you to write code that runs in response to application-level events,
such as Application_BeginRequest, application_start, application_error, session_start, session_end,

11. what is uses of Packages.config?

Packages.config file is managed by NuGet to track what packages and versions you have installed in the
application

12. what is uses of Web.config?

Web.config file contains application-level configurations.

routing in MVC

1. what is routing in ASP.NET?

ASP.NET introduced Routing to eliminate the needs of mapping each URL with a physical file.

2. define route? where it is stored in?

Route defines the URL pattern and handler information.

where it is stored in?

All the configured routes of an application stored in RouteTable

3. where you can register a route?

You can register a route in RouteConfig class, which is in RouteConfig.cs under App_Start folder.

4. write the url patter?

The URL pattern is considered only after the domain name part in the URL.

For example, the URL pattern "{controller}/{action}/{id}"

5. write example of a route? find domain,controller and action?

For example, http://localhost:1234/home/index


Routing in MVC Challenges?

6. Write ASP.NET MVC code that registers a defoult rout for HomeController and Index action?

public class RouteConfig

public static void RegisterRoutes(RouteCollection routes)

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

// Route for HomeController with an optional parameter

routes.MapRoute(

name: "HomeDefault",

url: "{controller}/{action}/{id?}",

defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }

);

7. Write ASP.NET MVC code that registers multiple routes for HomeController and StudentController?

public class RouteConfig

public static void RegisterRoutes(RouteCollection routes)

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

// Route for HomeController with an optional parameter

routes.MapRoute(

name: "HomeDefault",

url: "{controller}/{action}/{id?}",

defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }


);

// Route for StudentController with a custom URL structure

routes.MapRoute(

name: "StudentDetails",

url: "students/{studentId}/details/{action}",

defaults: new { controller = "Student", action = "Index" }

);

controller questions

what is controller?

The Controller in MVC architecture handles any incoming URL request.

what is the funtion of controller?

Controller in ASP.NET MVC

Financial Controller

what is the rule when naming controller?

what is scaffolding?

Scaffolding is an automatic code generation framework for ASP.NET web applications.

how to route controller?

controller challenges

write a home controller with index method?

write a home controller with contact method?


namespace MVC_BasicTutorials.Controllers

public class homeController : Controller

// GET: home

public ActionResult Index()

return View();

2: return "This is Index action method of StudentController";

write a student controller with index method?

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.Mvc;

namespace MVC_BasicTutorials.Controllers

public class StudentController : Controller

// GET: Student

public ActionResult Index()

{
return View();

model questions

what is the model in asp mvc?

In this section, you will learn about the model class in ASP.NET MVC framework.

where model classes lies in?

The model classes represents domain-specific data and business logic in the MVC application.

how to add model class in asp mvc ?

In the MVC application in Visual Studio, and right-click on the Model folder,

select Add -> and click on Class... It will open the Add New Item dialog box.

In the Add New Item dialog box, enter the class name Student and click Add.

model challenges

create model class student?

give public property StudentId

give public property StudentName

give public property Age?

public class Student

{
Public INT STUDENID { get; set; }

Public String STUDENTNAME { get; set; }

Public INT AGE { et; set; }

View questions

What is used a view in asp MVC?

A view is used to display data using the model class object.

Can controller have one or more view?

A controller can have one or more action methods,

And each action method can return a different view.

What is shared folder in a view?

The Shared folder contains views, layout views, and partial views, which will be shared among multiple
controllers.

What is razor? And what is used for?

Razor, in the context of ASP.NET MVC, is a server-side templating

Syntax used for building dynamic web pages.

List the types of razor view files? And what each supports?

.cshtml Supports C# code with html tags.

.vbhtml Supports Visual Basic code with html tags.

.aspx ASP.Net web form

.ascx ASP.NET web control

How to create view in asp MVC?


namespace MVC_BasicTutorials.Controllers

public class StudentController : Controller

// GET: Student

public ActionResult Index()

return View();

You might also like