ASP.NET Web Programming

Hans-Petter Halvorsen

Introduction

Learning Web Technology is essential today because Internet has become the number one source to information, and many of the traditional software applications have become Web Applications. Web Applications have become more powerfull and can fully replace desktop application in most situations.


Thats why you need to know basic Web Programming, including HTML, CSS and JavaScript.

 

To create more powerful Web Sites and Web Applications you also need to know about Web Servers, Database Systems and Web Frameworks like PHP, ASP.NET, etc.

 

If you want to learn basic Web Technology and Web Programming before you start learning ASP.NET, please click here.

 

ASP.NET is a Web Framework for creating Web Pages. ASP.NET is built on top of the .NET Framework.

 

Web Programming | ASP.NET Core

Below you find the new textbook "Web Programming | ASP.NET Core". You can freely download (click on the cover image below in order to open the textbook) it as a PDF file.

This textbook is available as an "Early Preview" edition. Not all resources are ready at the moment, but new resources are released continuously. These are "working documents" that are more or less updated continuously with new contents. Stay tuned!

 

Additional Resources:

Web Programming | ASP.NET Core (Textbook, PDF)

ASP.NET Core Overview (PowerPoint, PDF)

ASP.NET Core Videos (YouTube Playlist)


ASP.NET

ASP.NET is an open source web framework, created by Microsoft, for building web apps and services using the .NET Framework or the .NET Core. We have both ASP.NET and ASP.NET Core. ASP.NET Core is the new approach built on .NET Core.

 

ASP.NET comes in many flavours and programmings models. The Figure below gives an overview:

 

ASP.NET comes in many flavors:

ASP.NET Core

Web Programming | ASP.NET Core (Textbook, PDF)

ASP.NET Core Overview (PowerPoint, PDF)

 

ASP.NET Core is based on the .NET Core (not the ordinary .NET Framework).

 

We have:

 

I will focus on using ASP.NET Core with Razor Pages. Below you find some resources that introduce ASP.NET Core using Razore Pages.

 

Video: ASP.NET Core - Create your first Hello World Application:

This video is also available on my Youtube Channel (Industrial IT and Automation).

 

Video: ASP.NET Core - Introduction:

ASP.NET Core Overview (PowerPoint, PDF)

This video is also available on my Youtube Channel (Industrial IT and Automation).

 


Forms Data - Retrieving User Data from Client to Server

An HTML form is used to collect user input. The user input is most often sent to a server for processing.

ASP.NET Core - Forms Data: Retrieving User Data from Client to Server (YouTube) + PowerPoint (PDF)

 


Query String - Sending Data between Pages

Query String is used to retrieve the variable values in the HTTP query string, e.g., https://www.Website/ShowPerson.html?Person=Elvis. Multiple fields are separated by &, e.g., https://www.Website/ShowData.html?field1=value1&field2=value2&field3=value3.

ASP.NET Core - Query String: Sending Data between Pages (YouTube) + PowerPoint (PDF)

 


Data Binding - Retrieving User Data from Client to Server

An HTML form is used to collect user input. The user input is most often sent to a server for processing.

ASP.NET Core - Data Binding (Get User Data from Client-side to Server-side) (YouTube) + PowerPoint (PDF)

Getting Data from an SQL Server Database

ADO.NET is the core data access technology for .NET languages.

System.Data.SqlClient (or the newer Micrsoft.Data.SqlClient) is the provider or namespace you typically use to connect to an SQL Server.

 

ASP.NET Core - Get Data from Database (YouTube) + PowerPoint (PDF)

ASP.NET Core - Get Data from Database - Part 2 (YouTube)

ASP.NET Core - Get Data from Database - Part 3 (YouTube)

ASP.NET Core - Get Data from Database - Part 4 (YouTube)

 

Below you find other Database Videos that take you to the next level:

 

Video: ASP.NET Core - Database Communication:

Tutorial (PDF)

This video is also available on my Youtube Channel (Industrial IT and Automation).

 

Database Communication Code Example (ZIP)

 


Save Data to Database

ASP.NET Core - Save Data to Database (YouTube) + PowerPoint (PDF)

 


Database CRUD Application

CRUD Application means Creating, Reading, Updating and Deleting Data in a Database from your Application. The CRUD application presented here can be a foundation for all your Applications in ASP.NET Core. Typically all Applications today need to communicate with a Database and has CRUD functionality. When you have learned to create a basic CRUD Application, you have all the necessary tools you need to create any kind of Application.

Video: ASP.NET Core - CRUD Application:

Tutorial (PDF)

This video is also available on my Youtube Channel (Industrial IT and Automation).

Database CRUD Application Source Code (ZIP)

 


Connection String

The Connection String is used to connect to the database, but it can come in many flavours. SQL Server offers 2 different Authentication methods: SQL Server Authentication and Windows Authentication. Here you will find examples how you can configure and use these different Authentication methods.

Tutorial (PDF)

 


SQL Injection

SQL injection is a code injection technique that might destroy your database or expose information, such as passwords, etc. SQL injection is one of the most common web hacking techniques.

Preventing SQL Injection in ASP.NET Core (YouTube) + PowerPoint (PDF) + Code Example (ZIP)

 


Charts

Some basic Charts examples using ASP.NET Core will be demonstrated. The examples use the Google Charts framework.

In the examples Google Charts will be used. Google Charts is an API (or framework) for creating Charts in your web pages. It is free to use and it is easy to use (when you first know how to use it).

Video: ASP.NET Core - Charts:

Tutorial (PDF)

This video is also available on my Youtube Channel (Industrial IT and Automation).

Troubleshooting:

 

Charts Code Example (ZIP)

Class Library

In object-oriented programming , a class library is a collection of prewritten classes or coded templates, any of which can be specified and used by a programmer when developing an application program. In the video below, a Class Library will be created and used in order to share code between 2 different ASP.NET Core Web Applications.

Video: ASP.NET Core - Class Library:

Tutorial (PDF)

This video is also available on my Youtube Channel (Industrial IT and Automation).

Class Library Code Example (ZIP)

 


appSettings.json

appSettings.json is a configuration file used in ASP.NET Core Web Applications. It is typically used to store the Connection String to the Database, but it can be used to store lots of other settings that you need to use in your application.

Tutorial (PDF)

appSettings.json Code Example (ZIP)

 


Session Data

Session state is a mechanism that enables you to store and retrieve user specific values temporarily. It can be used to share data between different web pages.

Video: ASP.NET Core - Session Data:

Tutorial (PDF)

This video is also available on my Youtube Channel (Industrial IT and Automation).

Session Data Code Example (ZIP)

 

User Identity and Login

Typically you need to create functionality for User Registration, Login, etc. Here you will see how this can be done from scratch. If you do it from scratch, you will have full control of your code. If you use something called "ASP.NET Core Identity", which is explained in the next section, lots of "magic" happens behind the curtains. If something not working, it may be more complicated to figure out why.

Tutorial (PDF)

User Identity and Login Code Example (ZIP)

 

ASP.NET Core Identity

ASP.NET Core Identity is an API that supports user interface (UI) login functionality out of the box. You can manage users, passwords, roles, email confirmation, 2FA, and more. Users can create an account with the login information stored in Identity or they can use an external login provider. Supported external login providers include Facebook, Google, Microsoft Account, and Twitter.

The benefits of using ASP.NET Core Identity rather than creating it yourself from scratch is that you save time and other professional developers take care of security for you.

The disadvantage is that lots of "magic" happens behind the curtains. If something not working, it may be more complicated to figure out why.

Tutorial (PDF)

ASP.NET Core Identity Code Example (ZIP)

 

Unit Testing

Testing is important when creating Applications.Unit Tests are written by the Developers as part of the Programming. Each part is developed, and Unit tested separately (Every Class and Method in the code).

Video: ASP.NET Core - Unit Testing:

Tutorial (PDF)

This video is also available on my Youtube Channel (Industrial IT and Automation).

Unit Testing Code Example (ZIP)

Web Server IIS Deployment

Internet Information Services (IIS) is a Web Server created by Microsoft. It is tailormade for dealing with ASP.NET Web Applications. The video below shows how to deploy ASP.NET Core Web Applications to Internet Information Services (IIS). The Web Application used in the video is the ASP.NET Core CRUD Application.

Video: ASP.NET Core - Web Server IIS Deployment:

Tutorial (PDF)

This video is also available on my Youtube Channel (Industrial IT and Automation).

See also ASP.NET Core - Deploy to Virtual Test Environment (YouTube)

 

Azure Deployment

Microsoft Azure is a Cloud Service from Microsoft. You could say it is “Windows running in the Cloud”. Azure Portal: https://portal.azure.com

The Web Application used in the video is the ASP.NET Core CRUD Application.

Video: ASP.NET Core - Azure Deployment:

Tutorial (PDF)

This video is also available on my Youtube Channel (Industrial IT and Automation).

Do you get errors when running your ASP.NET Core Web App from Azure? See Turn on Development Mode in Microsoft Azure

 

Additional Resources

ASP.NET Example Applications

These applications show and demonstrate different ASP.NET Core features in real-life applications.

Weather System Example (ZIP)

Voting System Example (ZIP)

Tool Inventory System (PDF) + Download Source Code (ZIP)

 

Microsoft Resources:

Tutorial: Get started with ASP.NET Core (Microsoft)

Introduction to Razor Pages in ASP.NET Core (Microsoft)

Tutorial: Create a Razor Pages web app with ASP.NET Core (Microsoft)

Razor syntax reference for ASP.NET Core (Microsoft)

 

Other Resources:

Getting Started with ASP.NET Core Razor Pages

Learn Razor Pages

 

External Video Resources:

Making an ASP.NET Core Website (Microsoft, Channel 9)

ASP.NET Core 101 (Microsoft, Channel 9) - 13 Videos

ASP.NET Core - Razor Pages (LinkedIn Learning)

 

Programming Resources

Below you will find more interesting Programming resources


Web Programming

Learn more about Web Programming

HTML

Learn HTML Programming



LabVIEW

Learn Basic LabVIEW Programming

MATLAB

LabVIEW programming and Training



Software Engineering

Software Development and Enginnering Resources

Database Systems

Database Systems, Structured Query Language



Visual Studio/C#

Visual Studio and C# programming resources

Industrial IT

Industrial IT resources