0% found this document useful (0 votes)
32 views7 pages

Asp Unit - 1

This document provides an introduction to ASP.NET, focusing on the Common Language Runtime (CLR) and its role in managing .NET applications. It discusses code sharing techniques across different .NET frameworks, the structure of the .NET framework, and the benefits of using CLR, including improved performance and security. Additionally, it highlights how ASP.NET enhances developer productivity through built-in features and services that streamline the development process.

Uploaded by

parthsonar77
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views7 pages

Asp Unit - 1

This document provides an introduction to ASP.NET, focusing on the Common Language Runtime (CLR) and its role in managing .NET applications. It discusses code sharing techniques across different .NET frameworks, the structure of the .NET framework, and the benefits of using CLR, including improved performance and security. Additionally, it highlights how ASP.NET enhances developer productivity through built-in features and services that streamline the development process.

Uploaded by

parthsonar77
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

ASP.

NET UNIT 1

Unit No 1. Introduction to ASP.NET

1. Write note on CLR.


CLR is the basic and Virtual Machine component of the .NET Framework. It is the run-time
enviornment in the .NET Framework that runs the codes and helps in making the development
process easier by providing the various services. Basically, it is responsible for managing the
execution of .NET programs regardless of any .NET programming language. The code that runs
under the Common Language Runtime is termed as the Managed Code. In other words, you can
say that CLR provides a managed execution environment for the .NET programs by improving
the security, including the cross language integration and a rich set of class libraries etc. CLR is
present in every .NET framework version. Below table illustrate the CLR version in .NET
framework.

Below diagram illustrate how CLR is associated with the operating system/hardware along with
the class libraries. Here, the runtime is actually CLR.

Page 1 of 7
 Suppose you have written a program in any .net compliant language and save it in a file which is
known as the Source Code.
 Language specific compiler compiles the source code into the MSIL(Microsoft Intermediate
Language) which is also know as the CIL(Common Intermediate Language) or IL(Intermediate
Language) along with its metadata. Metadata includes the all the types, actual implementation
of each function of the program. MSIL is machine independent code.
 Now CLR comes into existence. CLR provides the services and runtime environment to the MSIL
code. Internally CLR includes the JIT(Just-In-Time) compiler which converts the MSIL code to
machine code which further executed by CPU. CLR also uses the .NET Framework class libraries.
Metadata provides information about the programming language, environment, version, and
class libraries to the CLR by which CLR handles the MSIL code. As CLR is common so it allows an
instance of a class that written in a different language to call a method of the class which
written in another language.

As the word specify, Common means CLR provides a common runtime or execution
environment as there are more than 60 .NET programming languages.
Main components of CLR:
 Common Language Specification (CLS)
 Common Type System (CTS)
 Garbage Collection (GC)
 Just In – Time Compiler (JIT)

Benefits of CLR:
 It improves the performance by providing a rich interact between programs at run time.
 Enhance portability by removing the need of recompiling a program on any operating
system that supports it.
 Security also increases as it analyzes the MSIL instructions whether they are safe or unsafe.
Also, the use of delegates in place of function pointers enhance the type safety and security.
 Support automatic memory management with the help of Garbage Collector.
 Provides cross-language integration because CTS inside CLR provides a common standard
that activates the different languages to extend and share each other’s libraries.
 Provides support to use the components that developed in other .NET programming
languages.
 Provide language, platform, and architecture independence.

Page 2 of 7
 It allows easy creation of scalable and multithreaded applications, as the developer has no
need to think about the memory management and security issues.

2. Explain Code sharing techniques in details


With .NET Core, we can currently develop applications with three different .NET frameworks
for different platforms. The traditional or standard .NET Framework is for Windows, Mono
framework for iOS, OSx and Android and .NET Core for Windows, Mac and Linux.

NET Frameworks

These frameworks use different framework class libraries. It means code written in one
framework cannot be used with other frameworks. For example, a console application
developed with .NET Framework cannot run on .NET Core or vice-versa. Thus, code-sharing is
not allowed.

It would be nice to write code once and share with other applications with different .NET
frameworks.

Code Sharing

To solve this problem of code sharing, we can use the following three approaches:

 .NET Standard Libraries – .NET Standard projects can implement code to be shared across
multiple platforms, and can access a large number of .NET APIs (depending on the version).
.NET Standard 1.0 - 1.6 implement progressively larger sets of APIs, while .NET Standard 2.0
provides the best coverage of the .NET BCL (including the .NET APIs available in Xamarin apps).
 Shared Projects – Use the Shared Asset Project type to organize your source code, and
use #if compiler directives as required to manage platform-specific requirements.

Page 3 of 7
 Portable Class Libraries (deprecated) – Portable Class Libraries (PCLs) can target multiple
platforms with a common API surface, and use Interfaces to provide platform-specific
functionality. PCLs are deprecated in the latest versions of Visual Studio – use .NET Standard instead.

3. Write Note on .NET framework.


A programming infrastructure created by Microsoft for building, deploying, and running
applications and services that use .NET technologies, such as desktop applications and Web
services
1) It is a platform for application developers.
2) It is tiered, modular, and hierarchal.
3) It is a service or platform for building, deploying and running applications.
4) It consists of 2 main parts: Common language runtime and class libraries.
• The common language runtime is the bottom tier, the least abstracted.
• The .NET Framework is partitioned into modules, each with its own distinct responsibility.
The architectural layout of the .NET Framework is illustrated in following figure:

Page 4 of 7
Here we examine the following key components of the .NET Framework:
1) Common Language Infrastructure (CLI): The purpose of the Common Language Infrastructure
(CLI) is to provide a language-neutral platform for application development and execution,
including functions for Exception handling, Garbage Collection, security, and interoperability.

2) Common Language Runtime ( CLR ): The .NET Framework provides a runtime environment
called the Common Language Runtime or CLR (similar to the Java Virtual Machine or JVM in
Java), which handles the execution of code and provides useful services for the implementation
of the program.
The CLR is the execution engine for .NET applications and serves as the interface between
.NET applications and the operating system. The CLR provides many services such as:

• Loads and executes code


• Converts intermediate language to native machine code
• Manages memory and objects
• Enforces code and access security
• Handles exceptions
• Interfaces between managed code, COM objects, and DLLs
• Provides type-checking
• Provides code meta data (Reflection)
• Provides profiling, debugging, etc.
• Separates processes and memory

3) Framework Class Library ( FCL ): It is also known as a base class library. The FCL is a collection of
over 7000 reusable classes, interfaces, and value types that enable .NET applications to :

a) read and write files,


b) access databases,
c) process XML,
d) display a graphical user interface,
e) draw graphics,
f) use Web services, etc.

• The .Net Framework class library (FCL) organized in a hierarchical tree structure and it is
divided into Namespaces. Namespaces is a logical grouping of types for the purpose of
identification. Framework class library (FCL) provides the consistent base types that are used
across all .NET enabled languages. The Classes are accessed by namespaces, which reside
within Assemblies.

• Other name of FCL is BCL – Base Class Library

4) Common Type System ( CTS )


• The CLS is a common platform that integrates code and components from multiple .NET
programming languages.
• CTS allow programs written in different programming languages to easily share information.

Page 5 of 7
• CLS forms a subset of CTS. This implies that all the rules that apply to CTS also apply to CLS
also.
• It defines rules that a programming language must follow to ensure that objects written in
different programming languages can interact with each other.
• CTS provide cross language integration.
• The common type system supports two general categories of types:
a) Value Type
b) Reference Type

a) Value Type: Stores directly data on stack. In built data type. For ex. Dim a as integer.

b) Reference Type: Store a reference to the value’s memory address, and are allocated on the
heap. For ex: dim obj as new oledbconnection.

• The Common Language Runtime (CLR) can load and execute the source code written in any
.Net language, only if the type is described in the Common Type System (CTS)

5) Common Language Specification ( CLS )


• CLS includes basic language features needed by almost all applications.
• CLS is a subset of the Common Type System.
• It serves as a guide for library writes and compiler writers.
• The CLS is also important to application developers who are writing code that will be used by
other developers.

6) Microsoft Intermediate Language:

• When you compile your Visual Basic .NET source code, it is changed to an intermediate
language (IL) that the CLR and all other .NET development environments understand.
• All .NET languages compile code to this IL, which is known as Microsoft Intermediate
Language, MSIL, or IL.
• MSIL is a common language in the sense that the same programming tasks written with
different .NET languages produce the same IL code.
• At the IL level, all .NET code is the same regardless of whether it came from C++ or Visual
Basic.
• When a compiler produces Microsoft Intermediate Language (MSIL), it also produces
Metadata.
• The Microsoft Intermediate Language (MSIL) and Metadata are contained in a portable
executable (PE) file.

7) Garbage Collector (GC)


• Garbage collection is a mechanism that allows the computer to detect when an object can
no longer be accessed.
• It automatically free up the memory used by that object.
• One of the functions of CLR is automatic memory management that uses that garbage
collection mechanism.
• The CLR’s Garbage Collector (GC) manages the allocation and releases of memory for an
application.

Page 6 of 7
4. Explain how ASP.NET provides more developer productivity.
One of the goals of ASP.NET is to enable developers to easily and quickly build feature-rich web
applications. To accomplish this, ASP.NET applications to identify the common features,
patterns, and code that developers build over and over today. Once they identified those
features, they componentized those features and included them as built-in functionality of
ASP.NET. ASP.NET team has a goal of reducing the number of lines of code required for an
application by a whopping 70%. Microsoft has introduced a vast collection of new features that
are now available to developers in ASP.NET.

Using these features, you can spend your time building richer, more fully featured applications
by adding the new controls and infrastructure services built into the core platform. ASP.NET
now includes built-in support for membership (username/password credential storage) and role
management services out of the box. The new personalization service provides for quick
storage/retrieval of user settings and preferences, enabling rich customization with minimal
code. With ASP.NET, Microsoft has introduced a new concept known as master pages that now
enable flexible page user interface (UI) inheritance across sites. The new site navigation system
enables developers to quickly build link structures consistently across a site. Site counters
enable rich logging and instrumentation of client browser access patterns. Themes enable
flexible UI skinning of controls and pages. And the new ASP.NET Framework enables rich portal-
style layout and end user customization features. Along with all these features, ASP.NET 2.0 also
brings with it 45 new server controls that enable powerful declarative support for data access,
login security, wizard navigation, image generation, menus, treeviews, portals, and more. The
next few sections will provide you with a glimpse of these features.

Page 7 of 7

You might also like