Ø
.NET version is released with some
significant improvements
ü .NET 1.0 - 2002 Initial version (1st
release)
ü .NET 1.1 - 2003 Update on 1.0, added
provider for Oracle
ü .NET 2.0 - 2005 Generics were
introduced.
ü .NET 3.0 - 2006 WPF, WCF, WF were introduced
ü .NET3.5 - 2007 LINQ and ADO .NET Entity
Framework
ü .NET 4.0 - 2010 Dynamic support for
languages and TPL (dynamic keyword introduced along with Task Parallel
library )
ü . NET 4.5 - 2012 Asynchronous programming
support (async and await keyword introduced And Zip facility).
Ø What
is basic authentication?
ü Client send request with user credential in
Authorization Header.
ü Credential encrypted with Base 64 encoding
and decoding.
ü WWW-Authenticate response header indicates
the Basic authentication.
Ø Disadvantage
of Basic Authentication.
ü User sends credential in each and every
request so it wills possibility to steal user’s credential.
ü It is implemented by Base 64 Algorithm so
this is known algorithm in universal.
Ø What
is JWT(Json Web Tokens) Token?
ü JWT is providing secure data transmission
between two parties.
ü Auto generated signed token using mechanism
like HMAC, RSA, ECDSA Algorithm.
Ø Advantage
of JWT(Json Web Tokens)
ü When it encoded size is smaller.
ü Use Algorithm like HMAC,RSA,ECDSA for
increase more security.
Ø Disadvantage
of JWT?
ü If a user account needs to be blocked or
deactivated, the application will have to wait for the token to expire in order
for the lockout to be fully effective.
ü Real logout is not possible until token not
expire.
ü We could not manually extend expiry time of
JWT token, so refresh token and reuse those token is not possible.
Ø What
is ActionResult in MVC?
ü MVC framework contains different result
classes when any action returns a result.
Ø How
many type of ActionResult?
ü ViewResult – Return html and markup.
ü EmptyResult – Return no response.
ü ContentResult- Return string literal.
ü RedirectToAction – Return on action method.
ü FileContentResult/FilePathResult/FileStreamResult-
Return the content of a file.
ü JavaScriptResult – Return a JavaScript.
ü JsonResult – Return Json.
ü RedirectResult – Redirect on new URL.
ü RedirectToRouteResult – Redirect on another
action or another controller.
ü PartialViewResult – Return HTML from partial
view.
ü HttpUnauthorizedResult – Return HTTP 403
Status.
Ø ASP.NET
MVC Life cycle.
ü First request URL check in to the routing
table.
ü If url found in the routing table, Routing
engine forwards the request url to the corresponding IRouteHandler(default is
MVCHandler) for that request.
ü MVCHandler is responsible to call the
controller using IControllerFactory instance.
ü After controller instantiated, Controller's
ActionInvoker identify which specific action to invoke on the controller.
ü The action method process on request, prepare
response data and returning a result according to their return result type (for
return result type follow our question “How many type of ActionResult?”).
ü View engine (IViewEngine interface) render
those action data on view for UI purpose.
Ø What
is routing in ASP.NET MVC?
ü Routing is the pattern matching system, which
matches the request URL into the routing table.
ü If request URL found into routing table,
forward those request to MVC handler and initiate the request otherwise routing
engine returns a 404 HTTP status code.
Ø Difference
between ViewBag and ViewData in ASP.NET MVC.
ü Both are used for transfer data from
controller to view.
ü ViewData is a Dictionary of objects and
accessible by string key
ü Ex. ViewData["Result"] = 1;
ü ViewBag is dynamic type
ü Ex. ViewBag.Result=1
ü View bag is dynamic type so doesn’t required to
type casting.
ü View data requires typing casting for complex
data type and also checking for null to avoid error.
ü How require type casting let’s see with
example.
Controller:
List<string> l = new List<string>() { "1", "3" };
ViewBag.Result = l;
View:
@foreach (var item in ViewBag.Result)
{
<span>@item</span>
}
Controller:
List<string> l = new List<string>() { "1", "3" };
ViewData["Result"] =
l;
View:
@foreach (var item in ViewData["Result"] as List<string>)
{
<span>@item</span>
}
Ø

0 Comments