SlideShare une entreprise Scribd logo
1  sur  5
Télécharger pour lire hors ligne
Articles from Jinal Desai .NET
ASP.NET MVC 4 New Features Interview Questions
2013-06-27 06:06:40 Jinal Desai
1. What is main focus of ASP.NET MVC 4?
Ans. The main focus of ASP.NET MVC 4 is making it easier to develop mobile web
applications. Other than mobile web applications it’s focus is also on better HTML5
support and making ASP.NET MVC web application cloud ready. Using new
features of ASP.NET MVC 4 you can develop web applications that can work well
across different mobile devices and desktop web browsers.
2. What is ASP.NET Web API?
Ans. ASP.NET Web API is a framework for building and consuming HTTP Services.
It supports wide range of clients including browsers and mobile devices. It is a great
platform for developing RESTful services since it talks HTTP.
3. You can also develop RESTful services using WCF, then why this new
framework Web API?
Ans. Yes we can still develop RESTful services with WCF, but there are two things
that prompt users to use ASP.NET Web API over WCF for development of RESTful
services. First one is ASP.NET Web API is included in ASP.NET MVC which
obviously increases TDD approach in the development of RESTful services.
Second one is for developing RESTful services in WCF you still needs lot of
configurations, URI templates, contracts and endpoints which developing RESTful
services using ASP.NET Web API is simple.
4. What are the enhancements done in default project template of ASP.NET
MVC 4?
Ans. The enhanced default project template is modern-looking. Along with cosmetic
enhancements, it also employs adaptive rendering to look nice in both desktop and
mobile browsers without need of any kind of additional customization.
5. Why separate mobile project template while you can render your web
application in mobile without additional customization?
Ans. The mobile project template touch-optimized UI using jQuery.Mobile.MVC
NuGet Package for smart phones and tablets.
6. What is Display Modes?
Ans. Display Modes is new feature provided in ASP.NET MVC 4. It lets an
application select views depending on the browser which is making request. For
example, if a desktop browser requests home page of an application it will return
ViewsHomeIndex.cshtml view and if a mobile browser requests home page it will
return ViewsHomeIndex.mobile.cshtml view.
7. Does ASP.NET MVC 4 supports Windows Azure SDK?
Ans. Yes, ASP.NET MVC 4 supports Windows Azure SDK version 1.6 or higher.
8. What is Bundling and Minification feature provided in ASP.NET MVC 4?
Ans. It reduces number of HTTP requests that a web page needs to make. Bundling
and Minification combines individual files into single, bundled file for scripts and CSS
and then reduce the overall size by minifying the contents of the bundle.
9. While developing application using ASP.NET MVC 4, I want to provide
authentication using popular sites like Facebook or twitter into my web
application, is it possible in ASP.NET MVC 4?
Ans. Yes, using DotNetOpenAuth library we can provide authentication using OAuth
or OpenID providers. In ASP.NET MVC 4 Internet project template includes this
library.
10. What’s the difference between Empty MVC Project template in ASP.NET
MVC 3 and ASP.NET MVC 4?
Ans. The ASP.NET MVC 4 Empty project template is really empty. It does not
contain any css and js files as compared to previous Empty project template, which
contains all these files.
11. What are the main features of ASP.NET MVC used by ASP.NET Web API?
Ans.
Routing: ASP.NET Web API uses same convention for configuration mapping that
ASP.NET MVC provides.
Model Binding and Validation: ASP.NET Web API uses same model binding
functionality, but tailored to HTTP specific context related operations only.
Filters: The ASP.NET Web API uses lots of filters built-in MVC.
Unit Testing: Now it’s based on MVC, truly unit testable.
12. If I want to create resource oriented services that can use full features of
HTTP like cache control for browsers, use URI templates to include Task
URIs in your responses, versioning and concurrancy using ETags, pass
various content types such as images, documents, HTML pages etc. then
which is preferred for development of services, WCF or Web API?
Ans. In such scenario Web API would be preferred choice. Using Web APIs we can
develop services which utilizes full features of HTTP.
13. Suppose I want to develop services which supports special scenarios
like one way messaging, duplex communication, message queues, ete then
which is the best way to develop services, WCF or Web API?
Ans. In this scenario WCF suits the requirement. WCF provides all kine of
messaging facility.
14. Now, if I want to create services which are exposed over various
transport channels like TCP, Named Pipe or even UDP. I also want the
support of HTTP transport channel when other transport channels are
unavailable then which is the preferred way, WCF or Web API and why?
Ans. For such scenario WCF is preferred way for development of services because
WCF support almost all kind of transport mechanism and we need to expose
SOAP-based and WebHTTP-based bindings.
15. What is the difference between asynchronous controller implementation
between ASP.NET MVC 3 and ASP.NET MVC 4? Can you explain in detail?
Ans. There is large difference between the working and implementation mechanism
between ASP.NET MVC 3 and ASP.NET MVC 4.
In ASP.NET MVC 3, to implement asynchronous controller/methods you need to
derive controller from AsyncController rather than from plain Controller class. You
need to create two action methods rather than one. Fist with suffix “Async” keyword
and second with “Completed” suffix. The method which initiated asynchronous
process must end with “Async” and the method which is invoked when the
asynchronous process finishes must end with “Completed”. Following is example
showing the same.
//Synchronous Implementation
public class SynchronousTestController : Controller
{
public ActionResult Index()
{
method1();
method2();
return View();
}
}
//Asynchronous Implementation in ASP.NET MVC 3
public class AsynchronousTestController : AsyncController
{
public void IndexAsync()
{
method1();
method2();
}
public ActionResult IndexCompleted()
{
return View("Index");
}
}
The ASP.NET MVC 4 Controller class in combination .NET 4.5 enables you to write
asynchronous action methods that return an object of type Task. The .NET
Framework 4 introduced an asynchronous programming concept referred to as a
Task and ASP.NET MVC 4 supports Task. The .NET Framework 4.5 builds on this
asynchronous support with the await and async keywords that make working with
Task objects much less complex than previous asynchronous approaches. The
await keyword is syntactical shorthand for indicating that a piece of code should
asynchronously wait on some other piece of code. The async keyword represents a
hint that you can use to mark methods as task-based asynchronous methods. To
implement asynchronous action method in ASP.NET MVC 4 we do no need to
derive our controller class from AsyncController, async and await in cooperation
with Task will do the magic. To mark the action method asynchronous use async in
method signature. To wait for the other method to finish use await and to call
multiple parallel methods use Task. The asynchronous method will return Task
instead of plain ActionResult.
public class AsyncronousTestController : Controller
{
public async Task<ActionResult> IndexAsync()
{
//if single method
//await method();
//if multiple methods
await Task.WhenAll(method1(), method2());
return View("Index");
}
}
Here the await keyword does not block the thread execution until the task is
complete. It signs up the rest of the method as a callback on the task, and
immediately returns. When the awaited task eventually completes, it will invoke that
callback and thus resume the execution of the method right where it left off.
16. Can you tell us some guidelines for when to use synchronous and when
to use asynchronous approach?
Ans. In following situations synchronous approach is more suited.
1. The operations are simple or short-running.
2. Simplicity is more important than efficiency.
3. The operations are primarily CPU operations instead of operations that involve
extensive disk or network overhead. Using asynchronous action methods on
CPU-bound operations provides no benefits and results in more overhead.
For asynchronous approach some of the guidelines are
1. You’re calling services that can be consumed through asynchronous
methods, and you’re using .NET 4.5 or higher.
2. The operations are network-bound or I/O-bound instead of CPU-bound.
3. Parallelism is more important than simplicity of code.
4. You want to provide a mechanism that lets users cancel a long-running
request.
5. When the benefit of switching threads out weights the cost of the context
switch. In general, you should make a method asynchronous if the
synchronous method waits on the ASP.NET request thread while doing no
work. By making the call asynchronous, the ASP.NET request thread is not
stalled doing no work while it waits for the web service request to complete.
6. Testing shows that the blocking operations are a bottleneck in site
performance and that IIS can service more requests by using asynchronous
methods for these blocking calls.
17. Which latest version of Entity Framework is included by ASP.NET MVC 4?
What is the advantage of it?
Ans. ASP.NET MVC 4 is included Entity Framework 5. The main advantage of Entity
Framework 5 is it’s new feature called database migration. It enables you to easily
evolve your database schema using a code-focused migration while preserving the
data in the database.
18. What is ASP.NET MVC 4 recipe? Can you explore something on recipes?
Ans. In technical language ASP.NET MVC 4 recipe is nothing but a dialog box that is
delivered via NuGet with associated UI and code used to automate specific task. It’s
like GUI for NuGet Package Manager. Recipes are set of assemblies which are
loaded dynamically by Managed Extensibility Framework (MEF). MEF provides
plugin model for applications. The main use of recipes are to automate development
task, tasks that are encapsulated into recipes and used over and over again. For
example, adding ajax grid to view or manipulating multiple areas of the application
can be automated using ASP.NET MVC 4 recipes.
18. What are the provisions for real time communication in ASP.NET MVC 4?
Ans. ASP.NET MVC 4 supports WebSockets along with the new open source
framework SignalR which allows to set up real time multi-user communication
through open TCP sockets.
19. What is the enhancement provided related to custom controller in
ASP.NET MVC 4?
Ans. In ASP.NET MVC 4 you can place custom controller to custom locations. In
ASP.NET MVC 3 you can only place custom controllers inside the Controllers folder.

Contenu connexe

Dernier

Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 

Dernier (20)

Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 

En vedette

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

En vedette (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

ASP.NET MVC 4 New Features Interview Questions

  • 1. Articles from Jinal Desai .NET ASP.NET MVC 4 New Features Interview Questions 2013-06-27 06:06:40 Jinal Desai 1. What is main focus of ASP.NET MVC 4? Ans. The main focus of ASP.NET MVC 4 is making it easier to develop mobile web applications. Other than mobile web applications it’s focus is also on better HTML5 support and making ASP.NET MVC web application cloud ready. Using new features of ASP.NET MVC 4 you can develop web applications that can work well across different mobile devices and desktop web browsers. 2. What is ASP.NET Web API? Ans. ASP.NET Web API is a framework for building and consuming HTTP Services. It supports wide range of clients including browsers and mobile devices. It is a great platform for developing RESTful services since it talks HTTP. 3. You can also develop RESTful services using WCF, then why this new framework Web API? Ans. Yes we can still develop RESTful services with WCF, but there are two things that prompt users to use ASP.NET Web API over WCF for development of RESTful services. First one is ASP.NET Web API is included in ASP.NET MVC which obviously increases TDD approach in the development of RESTful services. Second one is for developing RESTful services in WCF you still needs lot of configurations, URI templates, contracts and endpoints which developing RESTful services using ASP.NET Web API is simple. 4. What are the enhancements done in default project template of ASP.NET MVC 4? Ans. The enhanced default project template is modern-looking. Along with cosmetic enhancements, it also employs adaptive rendering to look nice in both desktop and mobile browsers without need of any kind of additional customization. 5. Why separate mobile project template while you can render your web application in mobile without additional customization? Ans. The mobile project template touch-optimized UI using jQuery.Mobile.MVC NuGet Package for smart phones and tablets. 6. What is Display Modes? Ans. Display Modes is new feature provided in ASP.NET MVC 4. It lets an application select views depending on the browser which is making request. For example, if a desktop browser requests home page of an application it will return ViewsHomeIndex.cshtml view and if a mobile browser requests home page it will return ViewsHomeIndex.mobile.cshtml view. 7. Does ASP.NET MVC 4 supports Windows Azure SDK? Ans. Yes, ASP.NET MVC 4 supports Windows Azure SDK version 1.6 or higher.
  • 2. 8. What is Bundling and Minification feature provided in ASP.NET MVC 4? Ans. It reduces number of HTTP requests that a web page needs to make. Bundling and Minification combines individual files into single, bundled file for scripts and CSS and then reduce the overall size by minifying the contents of the bundle. 9. While developing application using ASP.NET MVC 4, I want to provide authentication using popular sites like Facebook or twitter into my web application, is it possible in ASP.NET MVC 4? Ans. Yes, using DotNetOpenAuth library we can provide authentication using OAuth or OpenID providers. In ASP.NET MVC 4 Internet project template includes this library. 10. What’s the difference between Empty MVC Project template in ASP.NET MVC 3 and ASP.NET MVC 4? Ans. The ASP.NET MVC 4 Empty project template is really empty. It does not contain any css and js files as compared to previous Empty project template, which contains all these files. 11. What are the main features of ASP.NET MVC used by ASP.NET Web API? Ans. Routing: ASP.NET Web API uses same convention for configuration mapping that ASP.NET MVC provides. Model Binding and Validation: ASP.NET Web API uses same model binding functionality, but tailored to HTTP specific context related operations only. Filters: The ASP.NET Web API uses lots of filters built-in MVC. Unit Testing: Now it’s based on MVC, truly unit testable. 12. If I want to create resource oriented services that can use full features of HTTP like cache control for browsers, use URI templates to include Task URIs in your responses, versioning and concurrancy using ETags, pass various content types such as images, documents, HTML pages etc. then which is preferred for development of services, WCF or Web API? Ans. In such scenario Web API would be preferred choice. Using Web APIs we can develop services which utilizes full features of HTTP. 13. Suppose I want to develop services which supports special scenarios like one way messaging, duplex communication, message queues, ete then which is the best way to develop services, WCF or Web API? Ans. In this scenario WCF suits the requirement. WCF provides all kine of messaging facility. 14. Now, if I want to create services which are exposed over various transport channels like TCP, Named Pipe or even UDP. I also want the support of HTTP transport channel when other transport channels are unavailable then which is the preferred way, WCF or Web API and why? Ans. For such scenario WCF is preferred way for development of services because WCF support almost all kind of transport mechanism and we need to expose SOAP-based and WebHTTP-based bindings.
  • 3. 15. What is the difference between asynchronous controller implementation between ASP.NET MVC 3 and ASP.NET MVC 4? Can you explain in detail? Ans. There is large difference between the working and implementation mechanism between ASP.NET MVC 3 and ASP.NET MVC 4. In ASP.NET MVC 3, to implement asynchronous controller/methods you need to derive controller from AsyncController rather than from plain Controller class. You need to create two action methods rather than one. Fist with suffix “Async” keyword and second with “Completed” suffix. The method which initiated asynchronous process must end with “Async” and the method which is invoked when the asynchronous process finishes must end with “Completed”. Following is example showing the same. //Synchronous Implementation public class SynchronousTestController : Controller { public ActionResult Index() { method1(); method2(); return View(); } } //Asynchronous Implementation in ASP.NET MVC 3 public class AsynchronousTestController : AsyncController { public void IndexAsync() { method1(); method2(); } public ActionResult IndexCompleted() { return View("Index"); } } The ASP.NET MVC 4 Controller class in combination .NET 4.5 enables you to write asynchronous action methods that return an object of type Task. The .NET Framework 4 introduced an asynchronous programming concept referred to as a Task and ASP.NET MVC 4 supports Task. The .NET Framework 4.5 builds on this asynchronous support with the await and async keywords that make working with Task objects much less complex than previous asynchronous approaches. The await keyword is syntactical shorthand for indicating that a piece of code should asynchronously wait on some other piece of code. The async keyword represents a hint that you can use to mark methods as task-based asynchronous methods. To implement asynchronous action method in ASP.NET MVC 4 we do no need to derive our controller class from AsyncController, async and await in cooperation
  • 4. with Task will do the magic. To mark the action method asynchronous use async in method signature. To wait for the other method to finish use await and to call multiple parallel methods use Task. The asynchronous method will return Task instead of plain ActionResult. public class AsyncronousTestController : Controller { public async Task<ActionResult> IndexAsync() { //if single method //await method(); //if multiple methods await Task.WhenAll(method1(), method2()); return View("Index"); } } Here the await keyword does not block the thread execution until the task is complete. It signs up the rest of the method as a callback on the task, and immediately returns. When the awaited task eventually completes, it will invoke that callback and thus resume the execution of the method right where it left off. 16. Can you tell us some guidelines for when to use synchronous and when to use asynchronous approach? Ans. In following situations synchronous approach is more suited. 1. The operations are simple or short-running. 2. Simplicity is more important than efficiency. 3. The operations are primarily CPU operations instead of operations that involve extensive disk or network overhead. Using asynchronous action methods on CPU-bound operations provides no benefits and results in more overhead. For asynchronous approach some of the guidelines are 1. You’re calling services that can be consumed through asynchronous methods, and you’re using .NET 4.5 or higher. 2. The operations are network-bound or I/O-bound instead of CPU-bound. 3. Parallelism is more important than simplicity of code. 4. You want to provide a mechanism that lets users cancel a long-running request. 5. When the benefit of switching threads out weights the cost of the context switch. In general, you should make a method asynchronous if the synchronous method waits on the ASP.NET request thread while doing no work. By making the call asynchronous, the ASP.NET request thread is not stalled doing no work while it waits for the web service request to complete. 6. Testing shows that the blocking operations are a bottleneck in site performance and that IIS can service more requests by using asynchronous methods for these blocking calls.
  • 5. 17. Which latest version of Entity Framework is included by ASP.NET MVC 4? What is the advantage of it? Ans. ASP.NET MVC 4 is included Entity Framework 5. The main advantage of Entity Framework 5 is it’s new feature called database migration. It enables you to easily evolve your database schema using a code-focused migration while preserving the data in the database. 18. What is ASP.NET MVC 4 recipe? Can you explore something on recipes? Ans. In technical language ASP.NET MVC 4 recipe is nothing but a dialog box that is delivered via NuGet with associated UI and code used to automate specific task. It’s like GUI for NuGet Package Manager. Recipes are set of assemblies which are loaded dynamically by Managed Extensibility Framework (MEF). MEF provides plugin model for applications. The main use of recipes are to automate development task, tasks that are encapsulated into recipes and used over and over again. For example, adding ajax grid to view or manipulating multiple areas of the application can be automated using ASP.NET MVC 4 recipes. 18. What are the provisions for real time communication in ASP.NET MVC 4? Ans. ASP.NET MVC 4 supports WebSockets along with the new open source framework SignalR which allows to set up real time multi-user communication through open TCP sockets. 19. What is the enhancement provided related to custom controller in ASP.NET MVC 4? Ans. In ASP.NET MVC 4 you can place custom controller to custom locations. In ASP.NET MVC 3 you can only place custom controllers inside the Controllers folder.