Asp.Net core questions Flashcards
What is Asp.Net Core?
ASP.NET Core is a cross-platform, high-performance, open-source framework for building modern, cloud-enabled, Internet-connected apps. With ASP.NET Core, you can: Build web apps and services, Internet of Things (IoT) apps, and mobile backends.
-Abdul
What is model binding in ASP.NET?
The model binding system fetches the data from multiple sources such as form fields, route data, and query strings. It also provides the data to controllers and views in method parameters and properties, converting plain string data to .NET objects and types in the process.
-Abdul
What are the advantages of ASP.NET Core over ASP.NET?
There are the following advantages of ASP.NET Core over ASP.NET :
1 . It is cross-platform, so it can be run on Windows, Linux, and Mac.
- There is no dependency on framework installation because all the required dependencies are shipped with our application
- ASP.NET Core can handle more requests than the ASP.NET
- Multiple deployment options available with ASP.NET Core
——– Madhu Vasanth
What is middleware?
- it is a pipeline that handles the http requests and http responses.
- It is nothing but a component or class that can be executed for every request.
- it contains httphandlers and httpmodules that are executed for every request.
- there will be multiple middlewares . We can set the order of middleware execution.
- Each middleware adds or modifies http request and passes control to the next middleware component.
———- Madhu Vasanth
What is ASP.NET Controller?
- it is the central unit of mvc application, it is first receipent which interacts with http request and sends it to respective models
and gets the data and sends to respective view. - public methods in controller class are called as action methods.
- it controls flow of application by taking input and rendering proper output.
————– Madhu Vasanth
Differentiate between authentication and authorization.
1.Authentication is the process of verifying the identity of a user using some credentials like username and password while authorization determines the parts of the system to which a particular identity has access.
2.Authentication is required before authorization.
-Abdul
Difference between ASP.NET and MVC?
- ASP.NET is a web application framework developed by Microsoft for building dynamic web pages, web applications, and web services. It provides a programming model, a set of libraries, and tools for building and deploying web applications.
- MVC (Model-View-Controller) is a design pattern used for developing web applications that separates the application into three components: the model, the view, and the controller.
- Architecture: ASP.NET is a framework that supports multiple architectures, while MVC is a specific architecture pattern.
- Separation of concerns: MVC separates the application into three components, whereas ASP.NET does not enforce any specific separation of concerns.
- Manikandan R
What is model binding in ASP.NET?
- Model binding is the process of mapping data in an HTTP request to properties or parameters of a model in an ASP.NET application. It allows you to automatically populate a model with data from the request without having to write manual code to extract the data from the request.
- In an ASP.NET application, model binding is performed by the default model binder. The default model binder uses the type and name of the model’s properties or parameters to map the values in the HTTP request to the corresponding properties or parameters of the model.
- Manikandan R
What is caching in ASP.NET and its types?
- Caching is the process of storing frequently accessed data in memory or on disk so that it can be retrieved more quickly when it is needed. In an ASP.NET application, caching can help to improve performance by reducing the amount of time it takes to retrieve data or generate content.
- ASP.NET provides several mechanisms for caching data,
1. Output caching - Output caching stores the output of an entire page or user control in memory or on disk so that it can be quickly served to subsequent requests.
2. Fragment caching - Fragment caching stores the output of a specific part of a page or user control in memory or on disk so that it can be quickly served to subsequent requests. NOT sure if its uspported
3. Data caching - Data caching stores the results of a database query or other expensive operation in memory or on disk so that it can be quickly retrieved by subsequent requests.- Manikandan R
CORRECT ANSWER:https://learn.microsoft.com/en-us/aspnet/core/performance/caching/overview?view=aspnetcore-7.0
what is action method?
“Action methods” refers to a specific type of method that is used in controllers in the MVC (Model-View-Controller) architecture.
Action methods are responsible for handling incoming HTTP requests and returning an appropriate response. They are called “action” methods because they typically perform some action, such as retrieving data from a database, updating data, or rendering a view.
An action method is a method in a controller class with the following restrictions:
It must be public.
Private or protected methods are not allowed.
It cannot be overloaded.
It cannot be a static method.
An action method executes an action in response to an HTTP request.
V.Mounika
How is ASP.NET different from ASP.NET Core?
ASP.NET runs only on Windows, whereas ASP.NET Core can run on Windows, Linux, and macOS.
In ASP.NET Core, middleware is used to handle requests and responses, whereas in ASP.NET, server controls and events are used.
ASP.NET Core is more modular and lightweight than ASP.NET, which makes it easier and faster to develop web applications.
V.Mounika
What are Action Return types?
ASP.NET Core provides the following options for web API controller action return types:
1.Specific type:
The action method can return primitive type like int, string or complex type like List etc.
2.IActionResult:
The IActionResult return type is appropriate when multiple ActionResult return types are possible in an action. The ActionResult types represent various HTTP status codes.
If there are multiple return types and paths in this type of action, liberal use of the [ProducesResponseType] attribute is necessary.This attribute produces more descriptive response details for web API.[ProducesResponseType] indicates the known types and HTTP status codes to be returned by the action.
3.ActionResult:
It enables returning a type deriving from ActionResult or return a specific type.
ActionResult<T> offers the following benefits over the IActionResult type:
->The [ProducesResponseType] attribute's Type property can be excluded.</T>
4.HttpResults:
The HttpResults can be useful when sharing code between Minimal APIs and Web API.
V.Mounika
What is IIS?
IIS stands for Internet Information Services. It is a powerful web server developed by Microsoft. IIS can also act as a load balancer to distribute incoming HTTP requests to different application servers to allow high reliability and scalability.
- Ajithkumar
What is Caching?
Caching is a technique of storing frequently used data/information in memory,
so that, when the same data/information is needed next time,
it could be directly retrieved from the memory instead of being generated by the application.
Caching is extremely important for performance boosting in ASP.NET
Types:
- Data caching
- Page caching
- Fragment caching
-Ajithkumar
What is dependency injection?
Dependency injection is a design pattern that helps to develop loosely coupled code. This pattern is used extensively in ASP.NET.
Dependency injection means providing the objects that an object needs (its dependencies) in that object’s constructor instead of requiring the object to construct them.
Dependency injection reduces and often eliminates unnecessary dependencies between objects that don’t need to know each other. It also helps in testing by mocking or stubbing out the dependencies at runtime
-Ajithkumar
what is routing ?
Routing in ASP.NET is the process of mapping incoming HTTP requests to a specific handler or controller action method. This allows you to create clean and friendly URLs for your web application, making it easier for users to navigate and for search engines to index.
-jyothish
explain about filters?
Filters in ASP.NET are a way to intercept and modify the behavior of requests and responses in an ASP.NET MVC or Web API application. Filters are a powerful mechanism that can be used to implement cross-cutting concerns such as authentication, caching, logging, and error handling.
-jyothish
what is CORS ?
CORS stands for Cross-Origin Resource Sharing. It is a security feature implemented by web browsers to prevent web pages from making requests to a different domain than the one that served the original page.
By default, web browsers enforce the same-origin policy, which means that a web page can only make requests to the same domain and protocol as the page itself. This policy is designed to prevent malicious scripts from accessing sensitive information from other domains.
-jyothish
What is an Action Method?
An action method is a public method on a controller in ASP.NET MVC that is responsible for handling incoming HTTP requests and returning an HTTP response.
An action method can be used to perform a variety of tasks, such as querying a database, processing user input, and rendering a view.
An action method must be decorated with an attribute that specifies the HTTP method that it handles, such as [HttpGet] or [HttpPost].
-Maruthi
Explain HTTP protocol.
HTTP protocol is a client-server protocol, Which works based on request sent and it responds with appropriate response.
The web browsers can be called as the client which sends the request to server, To be precise HTTP protocol helps in transmitting hypermedia documents
Mahesh
Write down the name of all steps in the ASP.NET page life cycle?
Page request
Starting of page life cycle
Page initialization
Page Load
Validation
Post back event handling
Page rendering
Unload
by Raghu
Write down features of ASP.NET?
Extending .NET Framework: ASP.NET is a subset of the .NET Framework as it extends the .NET Framework with some libraries and tools to develop web apps. The thing that it adds to the .NET Framework is Libraries for common web patterns like MVC, Editor Extensions, the base framework to process the web requests, and web-page templating syntax like Razor, etc.
Performance: It is faster than the other web frameworks available in the market.
Backend Code: With the help of ASP.NET you can write the backend code for data access and any logic in C#.
Dynamic Pages: In ASP.NET, Razor provides the syntax for developing dynamic web pages with the help of C# and HTML. ASP.NET can be integrated with JavaScript and it also includes the frameworks like React and Angular for the SPA(Single Page Application.)
Supporting different OS: You can develop and execute ASP.NET apps on Windows, Linux, Docker, and macOS. The Visual Studio provides the tools to build .NET apps with different OS.
-jyothish