Core Faq
Core Faq
When you talk about asp.net interviews the range of questions can be very narrow or it can be very
wide. So do ensure you have proper preparation strategy at place. Remember ASP.NET has three
versions of framework. So we had ASP.NET Webforms which came in 2003, followed by the ASP.NET
MVC , then we had ASP.NET MVC Core.
Now if you are junior / fresher I would say stick to MVC Core and say you have just worked with MVC
core , so that you do not get the questions of Webforms and MVC.
But if you are senior you do not have too many choices you will need to prepare through right from
Webforms to MVC Core.
This eBook covers only ASP.NET MVC Core questions.
ASP.NET MVC Core is an open source, cross platform framework to develop web applications. When
you develop web applications using ASP.NET Core it can run on windows, Linux and mac.
Can you explain the difference between MVC core vs MVC 5 vs Webforms?
Now there are like 10 to 12 differences and if we try say all of them during interviews its not going to
work. Always remember let the interviewer speak more and you as a candidate should speak to the
point.
I have listed below all 12 points but would recommend to start with the first 4 points which are
highlighted.
Webforms (2003) ASP.NET MVC 5 (2009) ASP.NET MVC Core (2017)
Cross platform No No Yes
Performance Worst due to view Less than ASP.NET Core Best of all the versions.
state and page life
cycle.
Simplification Quite complicated Mediumly complicates Very simplified.
Cloud ready Not meant for cloud. Not complete Yes
HTML control Very less Good control due to Good control due to Razor view.
Razore view
Configuration Web.config Web.config Appsetting.json
Dependency Need third party Need third party Built in
Injection
Self-hosting No No Yes (Kestrel)
Static content No No such folder wwwroot
Nuget Managed Not Fully Not fully Completely Nuget managed
Drag and Drop Rad Full marks Need to code Need to code.
Development Only windows Only windows You can develop on mac , linux
using VS Code.
Dependency injection is practice of providing dependent objects for a class from outside rather than the
class creating it. So, in simple words the object creation process is isolated from the caller. This helps
to create a proper decoupled system.
This is an easy topic to understand but very difficult to explain to interviewer in simple words. So, I
would suggest to go through the below explanation, understand it and create your simple one liner.
There are three ways of doing DI: - Scoped, Transient and Singleton.
Transient: - Creates new instances, every single time service is injected.
Scoped: - Creates new instances, once per request made to server.
Singleton: - Instantiates one global object for all requests coming to server from any user.
The below image shows the same visually. In transient for every dependency injection new instance
will be injected. For example, in the below image for “obj” and “obj1” fresh new instances will be
injected for every request.
In case of scoped for every request same instance will be injected for every dependency injection. So
“obj” and “obj1” will have same instance injected.
In case of singleton one big global instance created. For all request , for all Dependency injection same
instance will be injected.
What are the various ways of doing session management in ASP.Net Core ?
• Session variables
• Tempdata
• ViewData / ViewBag
Kestrel is an open source default web server used by ASP.NET core application. Kestrel ships with
ASP.NET Core setup and works as in-process web server to handle web request. Kestrel is cross
platform it works on Linux , windows and Mac.
Every request of ASP.NET core goes through kestrel first.
ASP.NET core is meant to run cross platform. So, IIS as default server will not work , because IIS
works only on Windows. Web server like NGINX , Apache and so on have their own way to running
the application startup and ASP.NET core can not satisfy each one of them. So kestrel acts like a in-
process web server take a request send to MVC core application, get response and sends it back to the
main web server.
Explain concept of reverse proxy ?
Reverse proxy is a concept where the server acts like a mediator. Kestrel works on reverse proxy
concept it takes the request from the main web server like IIS / Apache and forwards its to MVC
application and vice-versa.
Session is user interaction which happens with a website over a period of time.Its interaction
which happens right when browser opens and browser closes.
Explain "HTTP is a stateless protocol" ?
HTTP does not remember states between request and response. User sends a request , server
processes it and sends response. Now if the user comes again in the same session server treats
its as a new request.
What are various way of doing session management ?
There are three primary ways of doing session management Session variables ,
viewdata/view bag and Tempdata.
To keep ASP.NET light weight session variables are not enabled by default.
Session variables are created for a particular user. Data of session variable is not shared
between users.
What is a cookie ?
Cookies are small text files information which is stored in the end users computer.
ViewBag vs ViewData ?
ViewBag is syntatic sugar over viewdata.
Explain viewModels ?
They represent data for a view.
Explain tempdata ?
Tempdata persists for the current and we can control do we want the state in the next request
or not.
What is WebAPI ?
Web API controller delivers data and services easily by using HTTP REST services.
REST stands for representational state transfer. REST is a architectural style/principle where
client and server talks in representations and states.
Some important principle of REST is Client Server,Statelessness,Unique URI,Manipulation
happens through representation,
WebAPI helps to expose services / data using HTTP protocol.
Can we use UDP/TCPIP protocol with Web API?
No
WebAPI vs WCF ?
WCF was meant for SOA , XML is compulsory format and support any protocol.
WebAPI was meant for REST, No compulsion on Format and supports only HTTP protocol.
What is the difference between creating .net std library and .net core library?
what is use of UseRouting and UseEndpoints in Startup Configure method
How to store ServiceCollection in different location other than ConfigureServices method
What is ViewComponent? and can we inject Dependency in ViewComponent?
how to use in-memory cache in asp.net core
how to store object in session other than string and int in asp.net core.
how to create CUSTOM MIDDLEWARE in ASP.NET CORE
use of launchsetting.json in ASP.NET Core
how to configure runtime compilation of views while development. :- AddRazorRuntimeCompilation();
Health checks
ASYNCACTIONFILTER IN ASP.NET CORE MVC
How to Secure asp.net core with oAuth2.0 and what is oAuth middle ware
2. Authentication in asp.net core web api and OWIN
3. Explain factory pattern using built - in DI in asp.net core
.csproj file, and it's importance in .net core. comparison of .csproj file with previous version of .net
Ways of implementing versioning in Asp.net core Api
What is IOption in ASP.NET core
Thank You!