Learning ASP.NET Core MVC Programming - Mugilan T. S. Ragupathi - E-Book

Learning ASP.NET Core MVC Programming E-Book

Mugilan T. S. Ragupathi

0,0
38,39 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

Learn the fundamentals of ASP.NET MVC and build real-world web applications using ASP.NET Core MVC

About This Book

  • Get a first-principles coverage of ASP.NET MVC and the latest release, Core
  • This book is uniquely designed for developers who are looking to transition their skills into the .NET development field
  • The standalone chapter structure leaves you free to explore ASP.NET MVC to immediately solve your pain points

Who This Book Is For

This book is for developers who want to learn to build web applications using ASP.NET Core, developers who want to make a career building web applications using Microsoft technology, and developers who are working in Ruby on Rails or other web frameworks and want to learn ASP.NET Core MVC.

No knowledge of the ASP.NET platform or the .NET platform is required. Even though you do not need to have experience in C#, an understanding of the basic constructs (loops, conditionals, classes, and objects) of any modern programming language would be helpful.

What You Will Learn

  • Get to know the concepts of ASP.NET MVC and build a new static web page using HTML, CSS, and jQuery
  • Set up a development environment and run a sample application using the template
  • Create a Controller with action methods
  • Build a view using several features of the Razor View engine
  • Construct a Model for ASP.NET Core MVC application
  • Devise a custom mechanism to provide maximum flexibility to your application through routing
  • Validate the user input on the client side using jQuery
  • Enhance your applications using Bootstrap
  • Explore new configuration and deployment scenarios—step by step guide to deploying ASP.NET Core web application in Linux

In Detail

ASP.NET Core MVC helps you build robust web applications using the Model-View-Controller design. This guide will help you in building applications which can be deployed on non-windows platforms such as Linux. In today's age, it is crucial that you possess the ability to separate the programming and business logic, and this is exactly what ASP.NET Core MVC application will help you achieve. This version comes with a number of improvements that enable fast, TDD-friendly development to create sophisticated applications. You would also learn the fundamentals of Entity framework and on how to use the same in ASP.NET Core web applications.

The book presents the fundamentals and philosophies of ASP.NET Core. Starting with an overview of the MVC pattern, we quickly dive into the aspects that you need to know to get started with ASP.NET. You will learn about the core architecture of model, view, and control.

Integrating your application with Bootstrap, validating user input, interacting with databases, and deploying your application are some of the things that you will be able to execute with this fast-paced guide. The end of the book will test your knowledge as you build a fully working sample application using the skills you've learned throughout the book.

Style and approach

This book takes a first-principles approach to help you understand and implement ASP.NET MVC solutions. It is focused primarily on giving you practical skills rather than the old conventional theoretical teaching.

Sie lesen das E-Book in den Legimi-Apps auf:

Android
iOS
von Legimi
zertifizierten E-Readern

Seitenzahl: 230

Veröffentlichungsjahr: 2016

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Learning ASP.NET Core MVC Programming
Credits
About the Author
About the Reviewers
www.PacktPub.com
Why subscribe?
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Introduction to ASP.NET Core
How web applications work
So what is an HTTP protocol?
Request-response pattern
Stateless nature of HTTP
Client-side and server-side
HTTP methods
GET method
POST method
What is ASP.NET?
ASP.NET Web Forms
ASP.NET Web Pages
ASP.NET MVC
Features of ASP.NET MVC
Convention over configuration
Separation of concerns
Control over the generated HTML
Better support for unit testing
ASP.NET 5
Features of ASP.NET 5
Summary
2. Setting Up the Environment
Purpose of IDE
Visual Studio offerings
System requirements
Visual Studio Community 2015
Visual Studio Professional
Visual Studio Enterprise
Visual Studio Test Professional
Installing Visual Studio Community
Installing ASP.NET 5
Project structure in ASP.NET 5 application
File-based project
Support for full .NET and .NET core
The Project.json package
Controllers
Models
Views
Migrations
The wwwroot folder
Other files
Summary
3. Controllers
Role of the Controller in ASP.NET MVC applications
Introduction to routing
Creating ASP.NET 5 application
Installing the ASP.NET Core NuGet package in your application
Our first Controller
IActionResult
Adding Views
Adding Models
Passing data from Controller to View
Filters
Authorization filters
Resource filters
Action filters
Exception filters
Result filters
Summary
4. Views
The View engine and the Razor View engine
Razor View engine
Programming in Razor View engine
Variables in Razor View
The for loop
The while loop
The foreach loop
The if condition
Layout
Creating _ViewStart.cshtml
Creating _Layout.cshtml
Adding a page-specific View
Generating HTML
HTML Helpers
Partial View
Calling the Partial View
View components
Creating a View component
Tag Helpers
Creating custom Tag Helpers
Summary
5. Models
Models
Models specific to a View component
Note on ViewModels
Data flow with respect to a Model
Model binding
The Entity Framework
The Entity Framework is independent of ASP.NET MVC
Creating console applications with the Entity Framework
Installing the Entity Framework 7 NuGet package
Using the NuGet Package Manager
Using the Package Manager Console
Installing Entity Framework commands
Creating Model classes
Creating the DbContext class
Create a migration
How the SaveChanges method works
Updating the record
Deleting the record
Using the Entity Framework in ASP.NET MVC applications
Database migration
Summary
6. Validation
Client-side and server-side validation
Server-side validation
Updating View models with the Data Annotation attribute
Updating the View model to display the validation error message
Updating the controller action method to verify the model state
Client-side validation
Implementation
Summary
7. Routing
Convention-based routing
Example 1
Example 2
Example 3
Example 4
Attribute-based routing
Route attribute at the controller level
Passing routing values in HTTP action verbs in the Controller
Route Constraints
Summary
8. Beautifying ASP.NET MVC Applications with Bootstrap
Knowing HTML and CSS
Bootstrap
Bootstrap Grid system
Forms
Inline forms
Horizontal forms
Table CSS classes
Striped tables
Hover tables
Bordered tables
Contextual classes in table
Buttons
Button sizes
Contextual colors
Using Bootstrap in your ASP.NET MVC application
Installing with Bower
HTML doctype
Summary
9. Deployment of ASP.NET Core Application
The project.json file
The dependencies node
The frameworks node
Microsoft Azure
Signing up to Microsoft Azure
Prerequisites to Azure deployment
Deploying the ASP.NET Core application in Azure
Deploying the ASP.NET Core web application in the Linux environment
Creating a Linux machine
Installing the PuTTY client
Installing of .NET Core in a Linux machine
Creating a new ASP.NET 5 project
Configuring the Nginx server
Summary
10. Building HTTP-based Web Services Using ASP.NET Web API
HTTP basics
HTTP verbs
GET method
PUT method
POST method
DELETE method
Fiddler tool
Dependency Injection
Delete method
The Web API method for deleting a resource
Web Repository layer code for deleting the employee data
Summary
11. Improving Performance of an ASP.NET Core Application
The UI layer
Reducing the number of HTTP requests
Using GZip compression
Using the Content Delivery Network (CDN)
Using JavaScript wherever possible
Using CSS stylesheets
Minification of JavaScript and CSS files and their combination
The caching process
Client-side caching
Response caching
The web/application layer
No business logic in Views
Using asynchronous logging
The DB layer
Understanding the queries generated by the ORM
Using classic ADO.NET if you really want to
Return only the required data
Fine tuning the indices
Using the correct column type and size for your database columns
Avoiding correlated subqueries
Generic performance improvement tips
Avoiding the Response.Redirect method
Using string builder
Summary
12. ASP.NET Core Identity
Authentication
Authorization
Adding the relevant dependencies to the project.json file
Adding ApplicationUser and ApplicationDbContext classes
Configuring the application to use Identity
Creating ViewModels
Creating Controllers and associated action methods
Creating Views
E-mail and SMS services
Securing an action method in a Controller
Summary

Learning ASP.NET Core MVC Programming

Learning ASP.NET Core MVC Programming

Copyright © 2016 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: November 2016

Production reference: 1101116

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham 

B3 2PB, UK.

ISBN 978-1-78646-383-8

www.packtpub.com

Credits

Author

Mugilan T. S. Ragupathi

Copy Editor

Safis Editing

Reviewers

Anuraj Parameswaran

Mustafa Erhan Ersoy

Anand Ranjan Pandey

Project Coordinator

Suzanne Coutinho

Commissioning Editor

Edward Gordon

Proofreader

Safis Editing

Acquisition Editor

Indrajit Das

Indexer

Rekha Nair

Content Development Editor

Zeeyan Pinheiro

Graphics

Kirk D'Penha

Technical Editor

Pavan Ramchandani

Production Coordinator

Melwyn D'sa

About the Author

Mugilan T. S. Ragupathi has been working on building web-based applications using Microsoft technology for more than a decade. He has been active in the ASP.NET community and has been running a successful blog, www.dotnetodyssey.com to help his fellow .NET developers.

His free beginners' course for ASP.NET MVC 5 (http://www.dotnetodyssey.com/asp-net-mvc-5-free-course/) was well received and is referred to as a concrete reference for beginners. He can be seen at csharp subreddit / Stack Overflow. He has written free micro eBooks, The 7 Most Popular Recipes of jQuery with ASP.NET Web Forms and Value & Reference types in C# (http://www.dotnetodyssey.com/free-ebooks/).

His book has received a good response and you can see the proof from one of his readers at https://twitter.com/jeffadamez. He is also an active contributor in Quora to the ASP.NET community (https://www.quora.com/profile/Mugil-Ragu). He likes to help readers with queries regarding ASP.NET.

About the Reviewers

Anuraj Parameswaran is a technical architect with Suyati Technologies (http://suyati.com/), Kochi. He has more than 12 years of extensive experience of working on different technologies, mostly in Microsoft space. He has been working on the .NET platform since its early days. He is a Microsoft Most Valuable Professional (MVP) in Visual Studio and Development Technologies. His focus areas are data analytics, architecture, and cloud computing. He is a K-MUG Community council member and an active volunteer in the Microsoft Technology Community. You can find his blog at http://dotnetthoughts.net.

Anuraj is also a reviewer of books and videos, namely, ASP.NET Web API Security Essentials, Learning ASP.NET Web API, and so on by Packt.

Mustafa Erhan Ersoy is a software team leader who is constantly evaluating new technologies and techniques in software development. He has been developing software professionally for 12 years and working mostly on ASP.NET web applications. He is very familiar with all aspects of transaction banking applications, BPM, and business workflows. He also blogs about web technologies, answers questions at stackoverflow.com, and participates in talks about ASP.NET and web technologies.

Anand Ranjan Pandey is currently working as a senior software developer for Dell. He is passionate about all aspects of software development, primarily and exclusively in the Microsoft .NET framework. He defines himself as an innovative technologist and visionary software developer with a passion for creating successful software products. He has comprehensive expertise in planning, managing, and achieving strategic business goals. Deep foundation in user-centered design, information architecture, and interactive new media.

He is an expert at building and leading cross-disciplinary technical teams and developing highly scalable and sustainable systems. He is successful at delivering technically challenging projects including enterprise e-commerce systems, secure exam portals, numerous software applications (web and shrink-wrap), content management systems, QA systems, networked publishing systems, and large-scale interactive multimedia learning exhibits. 

www.PacktPub.com

For support files and downloads related to your book, please visit www.PacktPub.com.

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

https://www.packtpub.com/mapt

Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.

Why subscribe?

Fully searchable across every book published by PacktCopy and paste, print, and bookmark contentOn demand and accessible via a web browser

Preface

The book aims to help you learn the fundamentals of ASP.NET Core MVC and apply that knowledge to building applications using ASP.NET Core. This book also aims to serve as a solid guide for beginners who want to learn ASP.NET MVC. In detail, the following topics are going to be covered in the book:

Fundamentals and objectives of ASP.NET Core MVCPhilosophies (separation of concerns, convention over configuration) of ASP.NET CoreComponents of ASP.NET Core MVC—Controllers, Models, and ViewsInteracting with the database using Entity FrameworkValidating the user’s input, both at the client-side and the server-sideProvide a face-lift to the application using BootstrapMaking use of different deployment options provided by ASP.NET Core MVC

What this book covers

Chapter 1, Introduction to ASP.NET Core, covers the fundamentals of ASP.NET MVC and how it fits in the ASP.NET ecosystem. This chapter explains the basics of web development, including client-side components and server-side components and what a programmer can do and can’t do in either layer

Chapter 2, Setting up the Environment, shows the reader how to set up the development environment, including the installation of Visual Studio and ASP.NET Core. Hardware and software requirements for setting up the development environment is also discussed and the anatomy of ASP.NET MVC applications is presented.

Chapter 3, Controllers, explains about what constitutes a Controller and action method along with its roles and responsibilities. In this chapter, a simple Controller along with an action method will be created. It will explain to the readers what an action method and a Controller does from the perspective of an overall ASP.NET MVC application.

Chapter 4, Views, presents what the Razor View engine does and explains the various basic programming constructs (conditionals, loops, and so on) with the examples using Razor view engine.

Chapter 5, Models, presents the role of Models in ASP.NET Core application. The concept of ViewModel is discussed along with how it provides flexibility and data compartmentalization to your applications.

Chapter 6, Validation, explains client-side and server-side validation with JavaScript and by using the jQuery libraries.

Chapter 7, Routing, explains about the routing module, which selects the appropriate controller from the received request with an example. Various options and features of routing are presented. This chapter will also guide you through building a custom route for ASP.NET MVC application based on business logic or for SEO purposes.

Chapter 8, Beautifying ASP.NET Application with Bootstrap, teaches how to use Bootstrap, a responsive frontend framework, to prettify your applications. You will be guided through the creation of HTML form controls.

Chapter 9, Deployment of ASP.NET Core Application, explains how the project.json library handles all of the dependencies of ASP.NET Core applications, along with the versions. It also explains how the K runtime (the latest option in ASP.NET Core application) so that an ASP.NET MVC application could be deployed in a non-Windows environment as well.

Chapter 10, Building Web Services Using Web API, explains HTTP-based services and how to implement them using the Web API. It will also introduce you to the Fiddler, and to compose an HTTP request using it.

Chapter 11, Improving Performance of an ASP.NET Core Application, explains the approaches to analyzing of performance and measures for improvement in various layers of your application.

Chapter 12, ASP.NET Core Identity, explains the security aspects of your application and implementing security identity of an application using Entity Framework.

What you need for this book

To start programming the ASP.NET MVC applications, you will need Visual Studio Community 2015 IDE. This is a fully featured IDE available for building desktops and web applications. You will also need various packages and frameworks, such as NuGet, Bootstrap, and project.json, the installation and configuration of which will be explained in the book.

Who this book is for

This book is for developers who want to learn how to build web applications using ASP.NET Core, developers who want to make a career building web applications using Microsoft technology, and developers who are working in Ruby on Rails or other web frameworks and want to learn how to use ASP.NET Core MVC.

No knowledge of the ASP.NET platform or the .NET platform is required. Even though you do not need to have experience with C#, an understanding of the basic constructs (loops, conditionals, classes, and objects) of any modern programming language would be helpful.

Reader feedback

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.

Customer support

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.

Downloading the example code

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 WindowsZipeg / iZip / UnRarX for Mac7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/learning-asp-dot-net-core-programming . We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from http://www.packtpub.com/sites/default/files/downloads/LearningAspDotNetCoreProgramming_ColorImages.pdf.

Errata

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

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.

Questions

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.

Chapter 1. Introduction to ASP.NET Core

ASP.NET Core, the latest version of ASP.NET MVC from Microsoft, is the server-side web application development framework which helps you to build web applications effectively. This runs on top of the ASP.NET 5 platform, which enables your application to be run on a wide variety of platforms, including Linux and Mac OS X. This opens up heaps of opportunities and it is exciting to be a .NET developer in these times.

In this chapter, you'll learn about the following topics:

Fundamental concepts about web applications—HTTP, client-side, and server-sideThree programming models of ASP.NET—ASP.NET Web Forms, ASP.NET Web Pages, and ASP.NET MVCPhilosophy of ASP.NET MVCFeatures of ASP.NET Core and ASP.NET 5

Before discussing the ASP.NET Core and its features, let us understand the fundamentals of web applications development. I strongly believe the principle that if you want to be an expert at something, you need to be very good at the fundamentals. It will be helpful in debugging the issues and fixing them.

Having said that we are going to discuss the following key fundamentals:

How web applications work, and a bit about HTTPClient-side and server-sideHTTP methods

Just three key concepts. No big deal!

How web applications work

All web applications, irrespective of whether they are built using ASP.NET MVC, Ruby on Rails, or any other new shiny technology, work on the HTTP protocol. Some applications use HTTPS (a secure version of HTTP), where data is encrypted before passing through the wire. But HTTPS still uses HTTP.

So what is an HTTP protocol?

HTTP stands for Hyper Text Transfer Protocol and is an application protocol which is designed for distributed hypermedia systems. "Hyper Text" in Hyper Text Transfer Protocol refers to the structured text that uses hyperlinks for traversing between the documents. Standards for HTTP were developed by the Internet Engineering Task Force (IETF) and the World Wide Web Consortium(W3C). The current version of HTTP is HTTP/2 and was standardized in 2015. It is supported by the majority of web browsers, such as Internet Explorer, Chrome, and Firefox.

The HTTP protocol (a protocol is nothing but a set of rules which govern the communication) is a stateless protocol that follows the request-response pattern.

Request-response pattern

Before talking about the request-response pattern, let us discuss a couple of terms: Client and server. A server is a computing resource that receives the requests from the clients and serves them. A server, typically, is a high-powered machine with huge memory to process many requests. A client is a computing resource that sends a request and receives the response. A client, typically, could be a web server or any application that sends the requests.

Coming back to the request-response pattern, when you request a resource from a server, the server responds to you with the requested resource. A resource could be anything—a web page, text file, an image , or another data format.

You fire a request. The server responds with the resource. This is called a request-response pattern.

Stateless nature of HTTP

When you request for the same resource again, the server responds to you with the requested resource again without having any knowledge of the fact that the same was requested and served earlier. The HTTP protocol inherently does not have any knowledge of the state knowledge of any of the previous requests received and served. There are several mechanisms available that maintain the state, but the HTTP protocol by itself does not maintain the state. We will explain the mechanisms to maintain the state later.

Let me explain to you about the statelessness and the request-response pattern to you with a simple practical example:

You type the following URL: https://en.wikipedia.org/wiki/ASP.NET_MVC. This is a Wikipedia web page about ASP.NET MVC.From the preceding URL, the browser fires a request to the Wikipedia server.The web server at Wikipedia serves you the ASP.NET MVC web page.Your browser receives that web page and presents it.You request the same page again by typing the same URL again (https://en.wikipedia.org/wiki/ASP.NET_MVC) and press Enter.The browser again fires the request to the Wikipedia server.Wikipedia serves you the same ASP.NET MVC web page without being aware of the fact that the same resource was requested previously from the same resource.

Note

As mentioned earlier, there are several mechanisms to maintain the state. Let us assume, for the time being, that no such mechanism is implemented here. I know that I am being too simplistic here, but this explains the point.

Client-side and server-side

It is necessary to understand the client-side and server-side of web applications and what can be done either side. With respect to web applications, your client is the browser and your server could be the web server/application server.

The browser side is whatever that happens in your browser. It is the place where your JavaScript code runs and your HTML elements reside.

The server-side is whatever happens at the server at the other end of your computer. The request that you fire from your browser has to travel through the wire (probably across the network) to execute some server-side code and returns the appropriate response. Your browser is oblivious to the server-side technology or the language your server-side code is written in. The server-side is also the place where your C# code resides.

Let us discuss some of the facts to make things clear:

Fact 1: All browsers can only understand HTML, CSS, and JavaScript, irrespective of the browser vendor.
You might be using Internet Explorer, Firefox, Chrome, or any other browser. Still, the fact that your browser can understand only HTML, CSS, and JavaScript holds true. It cannot understand C#. It cannot understand Java. Nor Ruby. Only HTML, CSS, and JavaScript. This is the reason why you can access the web applications, built using any technology could be accessed by the same browser.
Fact 2: The purpose of any web development framework is to convert your server-side code to HTML, CSS, and JavaScript.
This is related to the previous point. As browsers can only understand HTML, CSS, and JavaScript, all the web development technologies should convert your server-side code to HTML, CSS, and JavaScript so that your browser can understand. This is the primary purpose of any web development framework. This is true for whether you build your web applications using ASP.NET MVC, ASP.NET Web Forms, Ruby on Rails, or J2EE. Each web development framework may have a unique concept/implementation regarding how to generate the HTML, CSS, and JavaScript, and may handle features such as security performance differently. But still, each framework has to produce the HTML, because that's what your browsers understand.

HTTP methods

Even though all the requests of the HTTP protocol follow the request-response pattern, the way the requests are sent can vary from one to the next. The HTTP method defines how the request is being sent to the server.

The available methods in HTTP are GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, CONNECT, and PATCH. In most of the web applications, the GET and POST methods are widely used. In this section, we will discuss these methods. Later, we will discuss other HTTP methods on a need-to-know basis.

GET method

GET is a method of the HTTP protocol which is used to get a resource from the server. Requests which use the GET method should only retrieve the data and should not have any side effect. This means that if you fire the same GET request, again and again, you should get the same data, and there should not be any change in the state of the server, as a result of this GET request.

In the GET method, the parameters are sent as part of the request URL and therefore will be visible to the end user. The advantage of this approach is that the user can bookmark the URL and visit the page again whenever they want. An example is  www.yourwebsite.com?tech=mvc6&db=sql.

We are passing a couple of parameters in the preceding GET request. tech is the first parameter with the value mvc6 and db is the second parameter with the value sql