2 Introduction To Asp Net

NET Centric Computing · Unit 2 · 3 hrs

Introduction to ASP.NET

Exam-focused notes for Introduction to ASP.NET (NET Centric Computing, CSC378): what the TU syllabus asks and how it has actually been tested, with 3 solved past questions from this unit.

Introduction to ASP.NET in short

This unit places C# inside the wider .NET ecosystem: the difference between .NET, .NET Core, ASP.NET and its variants, the architecture and design principles behind the platform, how compilation and execution actually work, and the command line tooling used to build and run .NET Core applications day to day.

Introduction to ASP.NET: notes

.NET and ASP.NET frameworks: .NET, .NET Core, Mono, ASP.NET Web Forms, ASP.NET MVC, ASP.NET Web API, ASP.NET Core

.NET is a free, open-source development platform for building web applications, web services, desktop applications, mobile applications, and games. It is both a developer platform and an essential part of the operating system that helps applications execute. ASP.NET is a free web framework, also built by Microsoft, for building websites and web applications with HTML, CSS and JavaScript; it is a subset of the .NET Framework and the successor to classic ASP (Active Server Pages).

Aspect.NETASP.NET
ScopeFramework for Windows, web, and server applicationsThe part of .NET aimed at dynamic web pages
Application typesServer-side and client-sideServer-side web applications only
Typical useBusiness applications on WindowsDynamic websites and web applications
Language requirementAny language with a CIL (Common Intermediate Language) compilerAny .NET compliant language

.NET Core is a newer, general-purpose, cross-platform version of .NET maintained by Microsoft, written from scratch to be modular, lightweight and fast. Its defining characteristics are: it is open-source, hosted on GitHub under MIT and Apache 2 licenses; it is cross-platform, running on Windows, macOS and Linux through a runtime built for each operating system; it behaves consistently across architectures such as x64, x86 and ARM; it supports building a wide range of applications (mobile, desktop, web, cloud, IoT, games); it supports multiple languages (C#, F#, Visual Basic); and it stays compatible with the .NET Framework and Mono APIs through the .NET Standard specification.

Mono was an earlier cross-platform framework, originally an open-source implementation of the .NET Framework for Linux, known for its portability; the Unity game engine, for instance, uses Mono's C# support to build cross-platform games.

Within ASP.NET, several models coexist. ASP.NET Web Forms builds page-based applications from a combination of HTML, client script, server controls and server code; the server compiles and executes each requested page and returns rendered HTML. Its features include server controls (buttons, calendars, data-bound controls), master pages for a consistent site-wide layout, rich data binding to tables/lists, several state management options, security features, and processing optimizations. ASP.NET MVC structures an application around the Model-View-Controller pattern, giving a clean separation of concerns and full control over the rendered markup. ASP.NET Web API is a framework purpose-built for HTTP services consumed by a broad range of clients, including browsers and mobile apps, and is the natural fit for RESTful applications; it behaves much like ASP.NET MVC except that it returns serialized data instead of an HTML view. ASP.NET Core is the modern, cross-platform evolution of these ideas, unifying MVC-style and Web API-style development on top of .NET Core.

What this unit covers

  • .NET and ASP.NET frameworks: .NET, .NET Core, Mono, ASP.NET Web Forms, ASP.NET MVC, ASP.NET Web API, ASP.NET Core
  • .NET Architecture and Design Principles
  • Compilation and Execution of .NET applications: CLI, MSIL and CLR
  • .NET Core in detail
  • .NET CLI: build, run, test and deploy .NET Core Applications

.NET and ASP.NET frameworks

2079 · 5 marks

Differentiate between .NET and ASP.NET frameworks. How do you test the .NET core applications? [5]

--- Feature .NET Framework ASP.NET --------- Definition A general-purpose development platform maintained by Microsoft that provides runtime, libraries, and tools for building all types of applications A web development framework built on top of .NET, specifically designed for building dynamic we...

Open this answer on its own page →

2076 · 5 marks

What do you mean by Microsoft Net framework? Explain with example.[5]

Show solved answer

Microsoft .NET Framework

Definition

The .NET Framework is a software development platform developed by Microsoft that provides a controlled programming environment where software can be developed, installed, and executed on Windows-based operating systems. It provides tools and libraries for building and running applications using multiple programming languages such as C#, F#, and Visual Basic.

The .NET ecosystem includes several implementations:

  • .NET Framework (original Windows-based platform)
  • .NET Core (modern, cross-platform version)
  • Mono (open-source, cross-platform implementation)

Key Components of .NET Framework

1. Common Language Runtime (CLR)

The CLR is the execution engine of .NET. It manages code execution, memory management, and security. Code written in .NET languages is compiled into Intermediate Language (IL), which the CLR then executes.

2. Class Libraries / Base Class Library (BCL)

A large collection of reusable classes, interfaces, and value types that provide common functionality to all .NET applications.

3. Application Models / Technologies

TechnologyPurposeExample
Win FormsForm-based desktop applicationsNotepad-like client apps
ASP.NETWeb-based applicationsRuns on Chrome, Firefox, etc.
ADO.NETDatabase interactionOracle, Microsoft SQL Server

.NET Core (Modern Version)

.NET Core is the newer, improved version of the .NET Framework. It is:

  • Open-source -- maintained by Microsoft on GitHub under MIT and Apache 2 licenses
  • Cross-platform -- runs on Windows, macOS, and Linux
  • Modular and lightweight -- written from scratch for performance
  • Supports multiple languages -- C#, F#, Visual Basic
  • Wide range of applications -- mobile, desktop, web, cloud, IoT, games, machine learning
  • Consistent across architectures -- x64, x86, and ARM

Mono

Mono is another example of a cross-platform .NET implementation available on Windows, macOS, Linux, and more. It was originally designed as an open-source implementation of .NET Framework on Linux.

Example: The Unity game engine uses C# through Mono as a cross-platform way of creating video games. Mono provides the means to compile and run C# programs, similar to the .NET Framework.


Simple Example (C# Console Application on .NET Core)

using System;

namespace HelloDotNet
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello from .NET Framework!");
            Console.WriteLine("Platform: Cross-platform with .NET Core");
        }
    }
}

Output:

Hello from .NET Framework!
Platform: Cross-platform with .NET Core

This simple program can be compiled and run on Windows, macOS, or Linux using .NET Core, demonstrating the cross-platform nature of the framework.


Summary

FeatureDescription
DeveloperMicrosoft
Languages SupportedC#, F#, Visual Basic
Platform (.NET Core)Windows, macOS, Linux
Application TypesWeb, Desktop, Mobile, Cloud, IoT, Games
Open SourceYes (.NET Core on GitHub)

The .NET Framework (and its modern evolution .NET Core) provides a unified, powerful, and flexible environment for building a wide variety of applications across multiple platforms.

Open this answer on its own page →

.NET CLI

2078 · 10 marks

Explain the procedure for building, running, and deploying .NET core applications. Write a program to show the possibility of SQL injection attack.[10]

The .NET Core Command-Line Interface (CLI) is a cross-platform tool for creating, restoring packages, building, running, and publishing .NET applications. It is installed with the .NET Core SDK and does not need to be installed separately. Verify Installation: If usage information is displayed, t...

Open this answer on its own page →