What is ASP.NET ? - Part 1

ASP.NET is a Web Application Framework developed by Microsoft to build dynamic data-driven Web applications and Web Services supported by browsers. 
  • ASP.NET is a successor to Classic ASP(Active Server Pages)
  • ASP.NET is a subset of .NET Framework.
  • It allows Programmers/Developers/Organizations to build dynamic web sites using major languages like C# & VB.NET.
  • ASP.NET is Compiled, not Interpreted.
  • ASP.NET can be used to develop desktop web applications, mobile and tablet applications as well.
  • ASP.NET is object-oriented, multi-language, multi-device and multi-browser that runs inside the Common Language Runtime(CLR) of .NET Framework.

Other Technologies used to build web applications ?
  • Ruby on Rails,
  • Java/J2EE,
  • CGI/Perl,
  • Macromedia,
  • LAMP(Linux, Apache, MySQL, PHP).

What is a Web Application ?
  • A Web Application is an application that is accessed by users using web browsers.
  • Type of Web Browsers:
    1. Microsoft Internet Explorer,
    2. Google Chrome,
    3. Mozilla Firefox,
    4. Netscape Navigator.

Types of Web Applications ?
  • Customer-facing applications are known as eCommerce or B2C sites and use the internet. These typically present a customer with choices of products or services to buy using a shopping cart and payment method. Examples are travel reservations, http://www.amazon.com and http://www.ebay.com. This market has really taken off. 
  • Employee-facing applications use the intranet in a company. One example is a company's accounting application. Another might be employee expense reporting. A third might be the ERP (enterprise requirements planning) system. These applications previously operated on an internal client-server network. They are now web-enabled to make them easier to use and deploy. Disparate applications, such as an ERP and CRM (Customer Relationship Management) systems are now being integrated using XML and web services.
  • Customer-Supplier facing applications are known as B2B (Business to Business) sites and use the extranet, (an extension of an intranet that allows outside companies to work in a password-protected space). B2B sites provide a secure means for sharing selected information. One example is supply chain software that allows all suppliers to see demand and inventory in the supply chain. Another example is procurement software that allows a customer to send RFQs(Request For Quotations) and receive quotes over the web. A third example is collaboration software that allows companies to share product development and project management information.
Advantages of Web Applications ?
  • ASP.NET drastically reduces the amount of code required to build large applications.
  • With built-in Windows authentication and per-application configuration, your applications are safe and secured.
  • It provides better performance by taking advantage of early binding, just-in-time compilation, native optimization, and caching services right out of the box.
  • The ASP.NET framework is complemented by a rich toolbox and designer in the Visual Studio integrated development environment. WYSIWYG editing, drag-and-drop server controls, and automatic deployment are just a few of the features this powerful tool provides.
  • Provides simplicity as ASP.NET makes it easy to perform common tasks, from simple form submission and client authentication to deployment and site configuration.
  • The source code and HTML are together therefore ASP.NET pages are easy to maintain and write. Also the source code is executed on the server. This provides a lot of power and flexibility to the web pages.
  • All the processes are closely monitored and managed by the ASP.NET runtime, so that if process is dead, a new process can be created in its place, which helps keep your application constantly available to handle requests.
  • It is purely server-side technology so, ASP.NET code executes on the server before it is sent to the browser.
  • Being language-independent, it allows you to choose the language that best applies to your application or partition your application across many languages.
  • ASP.NET makes for easy deployment. There is no need to register components because the configuration information is built-in.

What is GAC ? - Part 13

Global Assembly Cache(GAC) :

  • GAC stands for Global Assembly Cache and contains strong named assemblies.
  • Assembly in the GAC can be shared by all assemblies without having to copy the assembly locally.
  • Basically, it is recommended to install an assembly into GAC, only when required and shared by applications, otherwise they should be kept private.

How to install an assembly into GAC :

There are two ways to install an assembly into GAC,
  • Drag and Drop through Windows Explorer,
  • Using Gacutil.exe(GAC Utility Tool)
To install an assembly using gacutil, use the following command:

gacutil -i C:\DemoProject\Demo.dll

Above command installs Demo.dll into the GAC.

To uninstall an assembly from GAC, use the following command:

gacutil -u DemoLibrary


What is CLS ? - Part 12

Today, we will discuss Common Language Specification, which is a subset of CTS.

Common Language Specification(CLS) :
  • It defines a set of rules and guidelines that every language must follow which runs under .NET Framework. The languages which follow these set of rules are considered CLS Compliant.
  • CLS enables cross-language integration.
  • Example, C# doesn't support multiple inheritance but C++ does support, so when you try to implement C++ code in C# code, it is not possible.

What is CTS ? - Part 11

Today, we will discuss CTS which is the one of the most important component of .NET Framework. Since, .NET is language independent and supports more than 25+ languages, developers need to code according to the datatypes in their own programming language.

Common Type System(CTS):

  • Common Type System defines how types are declared, used and managed in Common Language Runtime and is also an important of the runtime's cross language integration.
    • e.g an integer variable in c# is written as int, whereas in VB, it is written as Integer. In .NET framework, it is assigned to only single class that is System.Int32.
  • It establishes a framework which performs cross language integration, type-safety and high performance code execution.
  • Provides an object-oriented model that supports the complete integration of many programming languages.
  • Defines protocols that languages must follow which helps us to ensure that objects written in different languages can interact with each other.
  • CTS is classified as a single rooted hierarchy with System.Object as the base type from which all other types are derived.
  • CTS supports two different kinds of types:
    • Value Types: It contains a value that need to be stored directly on the stack or allocated in-line in structure.
    • Reference Types: It is stored as a reference to the values memory address and allocated on heap.

What is CLR ? - Part 10

Today, we will talk about the most important component of .NET Framework.

Common Language Runtime(CLR):

  • It is a core runtime and managed execution environment for Microsoft's .NET Framework. It manages the execution of code in different supported languages.
  • CLR transforms the source code into native code or byte code and then the program gets executed.
  • It works as a layer between Operating Systems and Applications written in .NET languages that conforms to Common Language Specification.
  • CLR Component JIT Compiler converts the IL code to native code on demand at application run-time.
  • The language compilers stores metadata that describes the members, references and types in the compiled code. The CLR uses the metadata to layout instances in memory, locate and load classes, enforce security, set runtime context boundaries and generate native code.
  • It provides services such as memory management, thread management, security management, code verification, compilation and other services.

Architecture of CLR:


Base Class Library:
  • It provides class libraries support to an application when IL code is converted to an Native code.
  • Conversion is done through JIT compiler and its end result is Portable Executable(PE) File.

Thread Support:
  • Thread is basically a light-weight processes responsible for multi-tasking within Single/Multiple Applications.
  • Threads are managed through CLR and it maintains parallel code execution.

COM Marshaller:
  • It enables communication between application and COM objects.

Type Checker:
  • CLR manages code execution by converting source code to IL code through language compilers which in turn converts IL code to native code.
  • IL code is also called managed code because CLR manages the code.

Exception Manager:
  • It allows us to perform debugging at application run time.

Common Language Specification(CLS):
  • CLS defines the rules and standards to which languages must adhere in order to be compatible with other .NET languages. 
  • It allows C# to inherit classes defined from different languages.

Common Type System(CTS):
  • It allows CLR to determine datatypes defined in two different languages to communicate with common base system.

Type Checker:
  • It allows CLR to verify types used in the application with CLR or CTS standards, to ensure type-safety.

Exception Manager:
  • Exception Manager will handle exceptions thrown by application while executing try/catch block provided by an exception.
  • In "Try" block where a part of code expects an error.
  • Whereas "Catch" block throws an exception caught from Try block, if there is no catch block, it will terminate application.

Security Engine:
  • It enforces security permissions at code-level security, folder-level security, and machine-level security using .NET Framework setting and tools provided.

Garbage Collector:
  • It handles automatic memory management and it releases memory of unused objects in an application.

Common .NET Framework Tools - Part 9

Let us discuss the various command line tools available within .NET Framework. These tools comes with .NET Framework and it should be used through Developer Command Prompt for Visual Studio.


Assembly Linker - Al.exe 
  • Al tool can create an assembly or resource file with the manifest in a separate file out of modules.
  • Syntax: al [source] [options]
  • This tool allows us to create multi-file assembly outside .NET. A multi-file assembly is useful to combine modules developed under different .NET languages into a single application.

Global Assembly Cache - Gacutil.exe
  • It allows you to view and modify contents of GAC. It maintains assembly versions and their dependency's.
  • Syntax: gacutil [options] [assemblyname | assemblypath | assemblyListFile]

IL Assembler - Ilasm.exe 
  • When we compile managed code, the code is converted into MSIL code; this is CPU independent language which is converted to native code.
  • We can use Ilasm tool to generate a portable executable (PE) file from the MSIL code. The resulting executable file is performance optimized, where the Ilasm tool does not create intermediate object file
  • Syntax: Ilasm [source] filename [options]
  • We can specify multiple source files to produce a single PE file.

IL Disassembler - Ildasm.exe 
  • Ildasm tool is used to view PE file contains that is nothing but the MSIL code as a parameter and creates the text file that consists of managed code.
  • Syntax: ildasm [options] [PEfilename] [options]

Code Access Security Policy Tool - Caspol.exe 
  • Caspol is nothing but Code Access Security Policy tool, which allows us to grant and modify permissions granted to code groups at the user-policy, machine-policy, and enterprise-policy levels. Etc...
  • Syntax: caspol [options]

Installer Tool - InstallUtil.exe

  • It is a command-line utility tool that allows you to install and uninstall server resources by executing the installer components in specified assemblies.
  • It works in addition with classes in System.Configuration.Install namespace.
  • Syntax: installutil [/u[ninstall]] [options] assembly [[options] assembly]

Strong Name Tool - Sn.exe
  • It helps sign assemblies with strong versions name.
  • It provides options for key management, signature generation and signature verification.
  • Syntax: sn [-quiet][option [parameter(s)]]

How to check which version of .NET Framework is installed on your machine ? - Part 8

Today, we will discuss about how to check which version of .NET framework is installed on your machine (mine is Windows 7).

3 Steps to find which version is installed on your machine:
  • Using Command Prompt
  • Using Windows Explorer
  • Using Registry

Using Command Prompt:
  • Open Command Prompt from start menu and execute following command,
    wmic /namespace:\\root\cimv2 path win32_product where "name like '%%.NET%%'" get version
    Copy the above command and open the command prompt, right+click on title bar of command prompt, select Edit -> Paste, the above command.
  • Hold on for few seconds it will show the list of all .NET framework versions installed on your Windows 7 machine,


          
Using Windows Explorer:  

  • Open Run window using Windows+R Keyboard short-cut or directly using Windows Explorer.
  • Copy the below command in above run window and hit Enter,
  • %windir%\Microsoft.NET\Framework\
  •  It will open the directory as shown in below screenshot, and you will see different .NET versions installed on your machine.


Using Registry:  

  • Type regedit into Run Window or Start searchbox and hit Enter, it will open Registry Editor.
  • Go to ->
  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP
  •  In below screenshot, we will see separate keys for each .NET Framework versions installed on your system,

I hope you would have enjoyed reading the above tutorial, to quickly check which version of .NET framework is installed on your machine.