Web applications have flourished in enterprise application development, even as mobile applications continue to rise in popularity. Moreover, the use of web APIs provides greater flexibility when it comes to building a backend that can serve both web apps and mobile apps. With ASP.NET Core 1.0, you get the benefits of a mature programming language such as C# with the performance of an all-new .NET Core that allows your web apps and web APIs to run on Windows, Mac, and Linux.
ASP.NET Core lets you choose your operating system during development, whether you're writing your code on a Surface Book, MacBook Air, or on a popular distribution of Linux. While this book primarily covers development on Visual Studio 2015 on a Windows system, you will find links to online guides if you wish to set up your environment on a different operating system.
ASP.NET Core 1.0 Essentials will introduce you to Microsoft's latest revision of ASP.NET, with everything you need to get started today. If you have already worked with ASP.NET MVC before, you will get a refresher of a few things you already know, followed by what's new. If you've only worked with ASP.NET Web Forms or other competing web frameworks, you will find the initial chapters very useful in laying the groundwork for what you need to know.
Chapter 1, Getting Started with ASP.NET Core, teaches you about ASP.NET Core 1.0, including MVC and web API. This chapter will explain the differences between the full .NET Framework 4.6 and .NET Core, while introducing Visual Studio 2015 and the all-new cross-platform Visual Studio Code.
Chapter 2, Building Your First ASP.NET Core Application, shows you how to create a new ASP.NET Core web application. This chapter will dissect the parts of a modern ASP.NET web application, while explaining what's new and what's changed.
Chapter 3, Understanding MVC, teaches you all about ASP.NET Core MVC by going deeper into controllers, views, and models. This chapter will explain how to create all the parts of a modern MVC application and then bring it all together.
Chapter 4, Using Web API to Extend Your Application, is about using the web API to extend your web application to support web and mobile applications. This chapter will explain how to create routes and configure a web API application and then consume it from a client application.
Chapter 5, Interacting with Web API using JavaScript, teaches you how to interact with the ASP.NET web API using straight JavaScript as well as popular frameworks such as AngularJS and KnockoutJS. This chapter will also cover developer tools, which automate important tasks and help during the development process.
Chapter 6, Using Entity Framework to Interact with Your Database in Code, teaches you how to use Entity Framework in the data layer of your web application. This chapter will introduce object-relational mapping (ORM) tools and the use of EF Code First Migrations .
Chapter 7, Dependency Injection and Unit Testing for Robust Web Apps, shows you how to implement dependency injection by using Inversion of Control . This chapter will cover DI, IoC containers, and Microsoft's new built-in support for dependency injection. The chapter will also cover the basics of unit testing.
Chapter 8, Authentication, Authorization, and Security, is about enabling authentication in ASP.NET web applications while implementing authorization for specific application features. The chapter will also cover guidelines for protecting user data and strategies to combat common security vulnerabilities in web applications.
Chapter 9, Deploying Your Application, covers how to deploy your applications to IIS on a web server or on Microsoft's Azure cloud platform. The chapter will also cover the use of continuous integration to run unit tests and deploy successfully compiled applications.
To learn ASP.NET Core and run the code examples for this book, the following software is recommended:
Windows 7 or higher (Windows 10 recommended)
Visual Studio 2015 Update 3 or higher (the free Community Edition is OK)
Any modern web browser, such as Microsoft Edge, Google Chrome, or Mozilla Firefox
Optional: Visual Studio Code (Windows, Mac, Linux)
For more information on developing for and running ASP.NET Core on systems other than Windows, please consult the Running ASP.NET Core on Windows, Mac OS X, Linux section in Chapter 1, Getting Started with ASP.NET Core. There, you will find a high-level overview of instructions for Mac and Linux, with links to online guides that are frequently updated.
This book is for software developers who have experience in .NET, preferably with C# or some other object-oriented programming language, which is required in order to build ASP.NET Core web applications. A basic understanding of web application development is also essential.
In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Uses the HTTP GET
method with optional querystring
parameters"
A block of code is set as follows:
app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); });
Any command-line input or output is written as follows:
dotnet restore dotnet build dotnet ef migrations add Initial dotnet ef database update
New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Enter some values and click the Create button."
Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
You can download the code files by following these steps:
Log in or register to our website using your e-mail address and password.
Hover the mouse pointer on the SUPPORT tab at the top.
Click on Code Downloads & Errata.
Enter the name of the book in the Search box.
Select the book for which you're looking to download the code files.
Choose from the drop-down menu where you purchased this book from.
Click on Code Download.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
WinRAR / 7-Zip for Windows
Zipeg / iZip / UnRarX for Mac
7-Zip / PeaZip for Linux
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/ASPdotNET-Core-Essentials. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at [email protected] with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.