Sei sulla pagina 1di 13

.

NET Framework:
Introduction :
.NET Framework: It's a Framework (a software program) for developing, Deploying and
running an application. It's free and easily available on internet or you can get this from
computer Magazine.
.NET Framework: It's a Framework (a software program) for developing, Deploying and
running an application. It's free and easily available on internet or you can get this from
computer Magazine CDs.

Let's see some other Definitions of .NET Framework:


• The Microsoft .NET Framework is a platform for building, deploying, and running
Web Services and applications. It provides a highly productive, standards-based, multi-
language environment for integrating existing investments with next-generation
applications and services as well as the agility to solve the challenges of deployment and
operation of Internet-scale applications. The .NET Framework consists of three main parts:
the common language runtime, a hierarchical set of unified class libraries, and a
componentized version of Active Server Pages called ASP.NET. (Source MSDN).

• The Microsoft .NET Framework is a managed code programming model for building
applications on Windows clients, servers, and mobile or embedded devices. Developers
use .NET to build applications of many types: Web applications, server applications, smart
client applications, console applications, database applications, and more.
(Source MSDN)

Difference between net framework 1.1 framework 2.0 and framework 3.5

Changes in 1.1 on comparison with 1.0


• .Net Framework provides Built-in support for ODBC and Oracle databases.
Previously they are available as an add-on for .NET Framework 1.0, now they are just part
of the framework.

Changes in 2.0 in comparison with 1.1


• Language support for generics built directly into the .NET CLR.
• Many additional and improved ASP.NET web controls.
• New data controls with declarative data binding.
• Partial classes
• Anonymous methods
• Data Tables

Changes in 3.0 in comparison with 2.0


• Windows Presentation Foundation(WPF),
• Windows Communication Foundation(WCF)
• Windows Workflow Foundation (WF)
• Windows Card Space
• Language Integrated Query (LINQ) along with its various providers
o LINQ to Objects
o LINQ to XML
o LINQ to SQL
• Paging support for ADO.NET
• ASP.NET AJAX is also included.
.NET Framework 4.0 features
• Parallel Extensions to improve support for parallel computing.
• PLINQ (Parallel LINQ), a parallel implementation of the LINQ engine
• Support for Code Contracts.
• It supports dynamic dispatch, named parameters, and optional parameter

Parts of .NET Framework:

CLR (Common Language Runtime)


Class Libraries
ASP.NET (Active Server Pages.NET)

Let's see the overall Architecture of .NET Framework

Picture (Courtesy about.com)

You can download the .NET framework 3.5 with Service pack 1 from here
http://msdn.microsoft.com/en-us/netframework/default.aspx

CLR: Common Language Runtime


Introduction :
CLR: Common Language Runtime is the heart of .NET Framework used to manage the
program written in .NET Framework compatible language (Eg. C#, Vb.NET, J# etc.). In
other words, CLR is Execution Engine which executes the program for .NET Framework.
CLR: Common Language Runtime is the heart of .NET Framework used to manage the
program written in .NET Framework compatible language (Eg. C#, Vb.NET, J# etc.). In
other words, CLR is Execution Engine which executes the program for .NET Framework.
Let's see some other definitions of CLR:
The common language runtime is the execution engine for .NET Framework applications.
It provides a number of services, including the following:

• Code management (loading and execution)


• Application memory isolation
• Verification of type safety
• Conversion of IL to native code
• Access to metadata (enhanced type information)
• Managing memory for managed objects
• Enforcement of code access security
• Exception handling, including cross-language exceptions
• Interoperation between managed code, COM objects, and pre-existing DLLs
(unmanaged code and data)
• Automation of object layout
• Support for developer services (profiling, debugging, and so on)
(Source MSDN)

The Common Language Runtime (CLR) is the virtual machine component of Microsoft''s
.NET initiative. It is Microsoft''s implementation of the Common Language Infrastructure
(CLI) standard, which defines an execution environment for program code. The CLR runs a
form of byte code called the Common Intermediate Language (CIL, previously known as
MSIL (Microsoft Intermediate Language)
(source Wikipedia).

How CLR Works?


When we write a program in .NET compatible language, then the compiler for C#(csc) or
VB.NET(vbc) compiles the code in IL (Intermediate Language) or MSIL(Microsoft
Intermediate Language) and then IL will be the input of CLR's component Just In Time
compiler to produce machine independent code.
Apart from the above CLR is also responsible for:
• Memory management
• Thread management
• Exception handling
• Garbage collection
• Security

CTS (Common Type System)

Introduction :
CTS (Common Type System) : Common Type System is the part of .NET Framework built in
with CLR which is responsible for defining , managing different language's operation
supported by .NET Framework.

CTS (Common Type System) : Common Type System is the part of .NET Framework built in
with CLR which is responsible for defining , managing different language's operation
supported by .NET Framework.

Let's see some other definitions:


• The common type system is a rich type system, built into the common language
runtime, that supports the types and operations found in most programming languages.
The common type system supports the complete implementation of a wide range of
programming languages.
(Source MSDN)

• The Common Type System (CTS) is a standard that specifies how Type definitions and
specific values of Types are represented in computer memory. It is intended to allow
programs written in different programming languages to easily share information. As used
in programming languages, a Type can be described as a definition of a set of values (for
example, "all integers between 0 and 10"), and the allowable operations on those values
(for example, addition and subtraction).
(Source Wikipedia)

Use / Importance of CTS:


• CTS are responsible for cross language Integration (Means you can have a dll which is
written in C# and to be used in VB.Net application) and Type Safety.
• Enforce a set of rules that a programming language must follow.

MSIL : (Microsoft Intermediate language)


MSIL : (Microsoft Intermediate language) or IL(Intermediate Language) is machine
independent code generated by .NET framework after the compilation of program written in
any language by you.
MSIL : (Microsoft Intermediate language) or IL(Intermediate Language) is machine
independent code generated by .NET framework after the compilation of program written in
any language by you.

MSIL or IL is now known as CIL(Common Intermediate Language).

Let's see some other definitions:


• MSIL is the CPU-independent instruction set into which .NET Framework programs
are compiled. It contains instructions for loading, storing, initializing, and calling methods
on objects.
Combined with metadata and the common type system, MSIL allows for true cross-
language integration.
Prior to execution, MSIL is converted to machine code. It is not interpreted.
(souce MSDN)

• When compiling to managed code, the compiler translates your source code into
Microsoft intermediate language (MSIL), which is a CPU-independent set of instructions that
can be efficiently converted to native code.(Source MSDN)
Common Intermediate Language (CIL, pronounced either "sil" or "kil") (formerly called
Microsoft Intermediate Language or MSIL) is the lowest-level human-readable programming
language in the Common Language Infrastructure and in the .NET Framework. Languages
which target the .NET Framework compile to CIL, which is assembled into bytecode. CIL is
an object-oriented assembly language, and is entirely stack-based. It is executed by a
virtual machine.

CIL was originally known as Microsoft Intermediate Language (MSIL) during the beta
releases of the .NET languages. Due to standardization of C# and the Common Language
Infrastructure, the bytecode is now officially known as CIL. Because of this legacy, CIL is
still frequently referred to as MSIL, especially by long-standing users of the .NET languages.
(source Wikipedia)

HtmlControls In ASP.NET

System.Web.UI.HtmlControls namespace is often ignored by ASP.NET developers. There is


an opinion that System.Web.UI.WebControls classes are more natural to ASP.NET web
application and I agree with that. However, HtmlControls namespace is still standard part of
.Net Framework just like WebControls. You can drag it from toolbox and easily drop it to
your web form. HtmlControls have its advantages in some scenarios and you should know
both namespaces so you can decide which class to use in your specific case.

What are HtmlControls?


HtmlControls are just programmable HTML tags. By default these tags are literal text and
you can't reference them with server side code. To "see" any HTML tag with your ASP.NET
server side code you need to add runat="server" and some value to ID parameter. For
example, to work with <textarea> HTML tag with server side code, you can use HTML code
like this:
<textarea runat="server" id="TextArea1" cols="20" rows="2"></textarea>
So, nothing hard here, we just set value of id property and add runat="server" part. After
this, we can manipulate with this tag with C# or VB.NET server side code, like this:
[ C# ]
protected void Page_Load(object sender, EventArgs e)
{
// set new size of textarea
TextArea1.Cols = 15;
}
[ VB.NET ]
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles
Me.Load
' set new size of textarea
TextArea1.Cols = 15
End Sub
HtmlControls are much less abstract than WebControls. With HtmlControls you work directly
with HTML output. WebControls are not always rendered on the same way. For example
TextBox control is rendered as <input type="text" /> tag if value of its TextMode property is
SingleLine but TextBox will render as <textarea > if TextMode=MultiLine.
How to apply styles to HtmlControls
HtmlControls have not styles property so you can't set style directly. To apply styles to
HtmlControls you need to use Attributes property, with code like this:
[ C# ]
TextArea1.Attributes["Style"] = "FONT-FAMILY: 'Arial'; COLOR: blue; BACKGROUND-COLOR:
yellow";
[ VB.NET ]
TextArea1.Attributes("Style") = "FONT-FAMILY: 'Arial'; COLOR: blue; BACKGROUND-COLOR:
yellow"
Differences between HtmlControls and WebControls

HtmlControls don't fire Click event on server side. Unlike WebControls, HtmlControls use
OnClick handler on client side. You can access to Click event by using javascript. To handle
click event on server side you need to use ServerClick event with event handler named
OnServerClick.
HtmlInputText control doesn't have Text property. To get string inside Html text box you
need to use Value property.
HtmlGenericControl also doesn't have Text property. To write text inside HtmlGenericControl
you need to use its InnerText property.
Advantages of HtmlControls
* HtmlControls are very useful if you need to translate classic ASP web site to ASP.NET. Just
add runat="server" to needed <input> or <select > tags and you can convert HTML form to
ASP.NET web form fast.
* With HtmlControls you can easily access any html tag on web page. For example, if you
want to change some attribute of <body> tag, just add runat="server" and you can do it
with one line of code like with TextArea in last example.
* If you need to manipulate HTML tags, you will can do it easily with HtmlControls, instead
of working with ASP.NET code inside of <% and %> like in classic ASP before.
* Reset of all input elements on form is very easy to do with HtmlInputReset control.
* Adding meta tags is easy to do with HtmlMeta control. Or, simply add id and
runat="server" to meta tag, like this:
<meta runat="server" name="description" id="MetaDescription">
Then, you can set meta description with line like this:
[ C# ]
MetaDescription.Attributes["content"] = "This is description of my web site.";
[ VB.NET ]
MetaDescription.Attributes("content") = "This is description of my web site."
System.Web.UI.HtmlControls classes
System.Web.UI.HtmlControls namespace contains these classes:
HtmlAnchor HtmlButton
HtmlForm HtmlImage
HtmlContainerControl HtmlControl
HtmlEmptyTagControlBuilder HtmlGenericControl
HtmlHead HtmlHeadBuilder
HtmlInputButton HtmlInputCheckBox
HtmlInputControl HtmlInputFile
HtmlInputHidden HtmlInputImage
HtmlInputPassword HtmlInputRadioButton
HtmlInputReset HtmlInputText
HtmlInputSubmit HtmlLink
HtmlMeta HtmlSelect
HtmlSelectBuilder HtmlTable
HtmlTable.HtmlTableRowControlCollection HtmlTableCell
HtmlTableCellCollection HtmlTableRow
HtmlTableRow.HtmlTableCellControlCollection HtmlTableRowCollection
HtmlTextArea HtmlTitle
HtmlControls endnote
Note that, by default, simple html tags can be anywhere on page, but programmable html
controls must be inside <form> tag. That form tag must have runat="server" attribute. Of
course, all programmable elements must be properly closed and nested.
There is no runat="client" attribute. If you try to write that, you'll get a parser error.
All HtmlControls are inherited from System.Web.UI.HtmlControls.HtmlControl. All html tags
that not exist in HtmlControls namespace can be accessed by using HtmlGenericControl.

Overview
In this section I plan to cover the basics of HTML controls in ASP.NET, this will get you
started with the rich new framework provided with ASP.NET.
Control Classifications
ASP.NET has given the developer the ability to product HTML code from the server side. If
your coming from classic ASP, you are accustomed to intermingling server side code with
HTML. With ASP.NET, the spaghetti code days are over (unless ofcourse you really like it
that way).
Server Controls have been divided into two major types:
• HTML Controls that are found in the System.Web.UI.HtmlControls namespace
• Web Controls that are found in the System.Web.UI.WebControls namespace
Note: Before we get started, let me point out one of the most common errors ‘newbies’
make when using server-side controls. When declaring the ASP.NET control’s tag in your
.aspx page, be sure to include the “runat=server” attribute. This will tell the compiler that
the follow tag is not a normal HTML tag, rather a ASP.NET control.
To demonstrate the power of HTML controls, I am going to jump right in and develop a
HTML table using 100% HTML controls.
The namespace which we will be working with is the System.Web.UI.HtmlControls.

his section covers the syntax used to declaratively set each of the ASP.NET HTML server
controls on a Web Forms page, and includes information about the properties shared among
all HTML server controls.
In this Section
Topic Description
Describes the HtmlAnchor control. The HtmlAnchor control
HtmlAnchor Control allows you to programmatically access the HTML <a> tag on
the server.
Describes the HtmlButtom control. The HtmlButton control
HtmlButton Control allows you to programmatically access the HTML <button> tag
on the server.
Describes the HtmlForm control. The HtmlForm control allows
HtmlForm Control you to programmatically access the HTML <form> tag on the
server.
Describes the HtmlGenericControl control. The
HtmlGenericControl class allows you to programmatically
HtmlGenericControl access HTML server control tags that are not represented by a
specific .NET Framework class, such as <span>, <div>,
<body>, and <font>.
Describes the HtmlImage control. The HtmlImage control
HtmlImage Control allows you to programmatically access the HTML <img> tag on
the server.
Describes the HtmlInputButton control. The HtmlInputButton
control allows you to programmatically access the HTML <input
HtmlInputButton Control
type= button>, <input type= submit>, and <input type=
reset> tags on the server.
Describes the HtmlInputCheckBox control. The
HtmlInputCheckBox
HtmlInputCheckBox control allows you to programmatically
Control
access the HTML <input type= checkbox> tag on the server.
Describes the HtmlInputFile control. The HtmlInputFile control
HtmlInputFile Controlallows you to programmatically access the HTML <input type=
file> tag on the server.
Describes the HtmlInputHidden control. The HtmlInputHidden
HtmlInputHidden Control
control allows you to programmatically access the HTML <input
type=hidden> tag on the server.
Describes the HtmlInputImage control. The HtmlInputImage
HtmlInputImage Control
control allows you to programmatically access the HTML <input
type= image> tag on the server.
Describes the HtmlInputRadioButton control. The
HtmlInputRadioButton
HtmlInputRadioButton control allows you to programmatically
Control
access the HTML <input type= radio> tag on the server.
Describes the HtmlInputText control. The HtmlInputText control
HtmlInputText Controlallows you to programmatically access the HTML <input type=
text> and <input type= password> tags on the server.
Describes the HtmlSelect control. The HtmlSelect control allows
HtmlSelect Control you to programmatically access the HTML <select> tag on the
server.
Describes the HtmlTable control. The HtmlTable control allows
HtmlTable Control you to programmatically access the HTML <table> tag on the
server.
Describes the HtmlTableCell control. The HtmlTableCell control
HtmlTableCell Controlallows you to programmatically access the HTML <td> and
<th> tags on the server.
HtmlTableRow Control Describes the HtmlTableRow control. The HtmlTableRow control
allows you to programmatically access the HTML <tr> tag on
the server.
Describes the HtmlTextArea control. The HtmlTextArea control
HtmlTextArea Controlallows you to programmatically access the HTML <textarea>
tag on the server.
Shared HTML Control
Describes the properties common to all HTML server controls.
Properties

1. HTML CONTROLS/Client Side:- HTML CONTROLS are standard controls and they
are part of HTML language. These are not classes but they are tags and we can only do
client-side programming with them.Client side code is reside at client's browser itself. It is
executed at client side only. User can easily see the code by View - > Source option.
It is generally used in validation form like text field is empty or not, email address validation
etc. It is faster than server side code.
2. HTML SERVER CONTROLS: HTML SERVER CONTROLS are the same as HTML controls but
they have runat=server attribute. With the HTML server controls we can do server-side
programming. This is more beneficial to those people who are migrating from old web
application to .NET applications.
3. WEB CONTROLS: WEB CONTROLS are .NET classes and they have rich set of properties,
methods, and events. They are programmable on client side as well server side. There are
many control that offer same UI(User Interface)but have more features to HTML controls.
For eg. Calendar controls, data grid controls and validation controls and these control
render to client as HTML controls.

Client controls are the HTML controls, find below the difference between them.
Server Controls
Advantages:

1. ASP .NET Server Controls can however detect the target browser's capabilities and
render themselves accordingly. No issues for compatibility issues of Browsers i.e page that
might be used by both HTML 3.2 and HTML 4.0 browsers code to be written by you.
2. Newer set of controls that can be used in the same manner as any HTMl control like
Calender controls. (No need of Activex Control for doing this which would then bring up
issues of Browser compatibility).
3. Processing would be done at the server side. In built functionality to check for few
values(with Validation controls) so no need to choose between scripting language which
would be incompatible with few browsers.
4. ASP .NET Server Controls have an object model different from the traditional HTML and
even provide a set of properties and methods that can change the outlook and behavior of
the controls.
5. ASP .NET Server Controls have higher level of abstraction. An output of an ASP .NET
server control can be the result of many HTML tags that combine together to produce that
control and its events.

Disadvantages:

1. The control of the code is inbuilt with the web server controls so you have no much of
direct control on these controls
2. Migration of ASP to any ASP.NET application is difficult. Its equivalent to rewriting your
new application
Client Controls
Advantages:

1. The HTML Server Controls follow the HTML-centric object model. Model similar to HTML
2. Here the controls can be made to interact with Client side scripting. Processing would be
done at client as well as server depending on your code.
3. Migration of the ASP project thought not very easy can be done by giving each intrinsic
HTML control a runat = server to make it HTML Server side control.
4. The HTML Server Controls have no mechanism of identifying the capabilities of the client
browser accessing the current page.
5. A HTML Server Control has similar abstraction with its corresponding HTML tag and offers
no abstraction.

Disadvantages:
1. You would need to code for the browser compatibility.
HTML Intrinsic Controls
Advantages:
1. Model similar to HTML
2. Here the controls can be made to interact with Client side scripting

Disadvantages:
1. You would need to code for the browser compatibility

Cascading Style Sheets

In our CSS tutorial you will learn how to use CSS to control the style and layout of multiple
Web pages all at once.

Introduction: CSS is a cross platform solution for the standardization of website formatting
and provides consistent visual appearance throughout the application. It works with the
conjunction of HTML 4 and so supported by all modern browsers.
Creating Style sheets: To include the empty stylesheet follow:
Website - Add New Item, Select StyleSheet, and click OK.
It will create a css class with mentioned name and .css extension.
Rules: Style sheets consist of rules which define the formatting information for the
particular ingredients under the web page. Each rule name has two parts. The portion
before the period indicates the tag to which the rule applies. The portion after the period is
a unique name (called the CSS class name). Rules can be specified in following manner:
1. If standard tag name (body, h1, td etc) is specified without any period then the rules are
applied to all such tags under the web page.
H1
{
font – weight : bold;
}
Constraint will be set to all H1 tag.
2. If only css class name is mentioned (portion after the period) then the rules are
applicable to all the tags with specified class name.
.BoldText
{
font – weight : bold;
}
Constraint will be set to all tags where css class name is specified as “BoldText”.
3. If complete rule name is mentioned (portion at the both side of period) then the rules are
applied to the specified tag with the specified class name.
H1.BoldText
{
font – weight : bold;
}
Constraint will be set to all H1 tags where css class name is specified as “BoldText”.
Applying stylesheet into the web page: Add the <link > tag under the <Head> section and
give reference of the specific stylesheet.
<link href="StyleSheet.css" rel="stylesheet" type="text/css" />
Where href attribute is set to the location of the required stylesheet class (.css).
Now the rules, under the stylesheet, can be applied to the web controls by setting CssClass
property:
<asp:Label ID="Label1" runat="server" Text="Hello" CssClass=" BoldText "></asp:Label>
As “BoldText” rule is open for all tags with specified css class name.

CSS Example
body

background-color:#d0e4fe;

h1

color:orange;
text-align:center;

font-family:"Times New Roman";


font-size:20px;

What You Should Already Know


Before you continue you should have a basic understanding of the following:
• HTML / XHTML
What is CSS?
• CSS stands for Cascading Style Sheets
• Styles define how to display HTML elements
• Styles were added to HTML 4.0 to solve a problem
• External Style Sheets can save a lot of work
• External Style Sheets are stored in CSS files

Styles Solved a Big Problem


HTML was never intended to contain tags for formatting a document.
HTML was intended to define the content of a document, like:
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
When tags like <font>, and color attributes were added to the HTML 3.2 specification, it
started a nightmare for web developers. Development of large web sites, where fonts and
color information were added to every single page, became a long and expensive process.
To solve this problem, the World Wide Web Consortium (W3C) created CSS.
In HTML 4.0, all formatting could be removed from the HTML document, and stored in a
separate CSS file.
All browsers support CSS today.

CSS Saves a Lot of Work!


CSS defines HOW HTML elements are to be displayed.
Styles are normally saved in external .css files. External style sheets enable you to change
the appearance and layout of all the pages in a Web site, just by editing one single file!

CSS Syntax
A CSS rule has two main parts: a selector, and one or more declarations:
The selector is normally the HTML element you want to style.
Each declaration consists of a property and a value.
The property is the style attribute you want to change. Each property has a value.

CSS Example
CSS declarations always ends with a semicolon, and declaration groups are surrounded by
curly brackets:

p {color:red;text-align:center;}
To make the CSS more readable, you can put one declaration on each line, like this:
Example

color:red;
text­align:center;

CSS Comments
Comments are used to explain your code, and may help you when you edit the source code
at a later date. Comments are ignored by browsers.
A CSS comment begins with "/*", and ends with "*/", like this:
/*This is a comment*/

text-align:center;
/*This is another comment*/
color:black;
font-family:arial;

What is ASP.net?
This tutorial written and contributed by Mitchell Harper. Please see footnote for more info.
You've probably heard the word ASP.net fairly often these days, especially on developer
sites and news. This article will explain what the fuss is all about. ASP.NET is not just the
next version of ASP; it is the next era of web development . ASP.NET allows you to use a
full featured programming language such as C# (pronounced C-Sharp) or VB.NET to build
web application easily.
ASP.NET still renders HTML
Unfortunately, the Internet still has bandwidth limitations and not every person is running
the same web browser. These issues make it necessary to stick with HTML as our mark-up
language of choice. This means that web pages won't look quite as amazing as a fully
fledged application running under Windows, but with a bit of skill and creative flair, you can
make some rather amazing web applications with ASP.NET. ASP.NET processes all code on
the server (in a similar way to a normal application). When the ASP.NET code has been
processed, the server returns the resultant HTML to the client. If the client supports
JavaScript, then the server will use it to make the clients browser experience quicker and
easier. Even with HTML being the limiting factor here, ASP.NET still manages to bring true
OOP (Object Oriented Programming) to the Internet.
OOP on the Internet
Object Oriented Programming makes it possible to build extremely large applications, while
still keeping your code clean and structured. Now with ASP.NET, we can do the same on the
web. Traditional ASP uses HTML and VBScript (or Jscript) to process and render pages, but
because VBScript is a scripting language, you were forced to write spaghetti code (VBScript
was entwined in the HTML and ended up rather messy in larger applications). ASP.NET
separates code from display, and you can even have pages with no ASP.NET code in them at
all. By adding references in your HTML (called controls), you can tell ASP.NET that you want
a button here, some text there, and then in your code, you can manipulate what these
controls look like, what they display, how big they are, etc. Controls can do more than just
display information. You can add events to controls, so that when a visitor clicks on a
button, for example, ASP.NET executes a function of your choice.
Web Services
One great feature of ASP.NET is Web Services. Web services mean that you can literally
have several pieces of your application on different servers all around the world, and the
entire application will work perfectly and seamlessly. Web services can even work with
normal .NET Windows applications. For example: A lot of people would like to have a stock
ticker on their web site, but not many people want to manually type in all changes to the
prices. If one company (a stock broker) creates a web service and updates the stock prices
periodically, then all of those people wanting the prices can use this web service to log in,
run a function which grabs the current price for a chosen company, and return it. Web
services can be used for so many things: news, currency exchange, login verification.. the
ways in which they can be used are limited to your imagination!
Great XML Support
ASP.NET makes it simple to use XML for data storage, configuration and manipulation. The
tools which are built into ASP.NET for working with XML are very easy to use. XML is
excellent for storing information that rarely changes, because you can just cache that
information in the computers memory after it has been initially extracted.
Class Library
ASP.NET includes an enormous class library which was built by microsoft. Because this class
library is so large, it encapsulates a a huge number of common functions. For example, if
you wanted to retrieve data from a database and display that data in a simple grid control
through classic ASP, then you'd have to write quite a lot of code.

In ASP.NET, you don't write any code to display the data: you just write the code to bind the
data to an object called a DataGrid (which can be done in just a couple of lines). Then, you
just have to create a reference on your page to where that DataGrid should go. The
DataGrid will be rendered as a table, and will contain all of the data extracted from the
database.
Microsoft has created an amazingly well designed MSDN library for ASP.NET and all of the
other .NET languages. It includes a full class library containing information and examples on
every class, function, method, and property accessible through ASP.NET.

The MSDN library also includes some tutorials and examples to get you started. It may take
you a while to get used to the format and layout of the MSDN ASP.NET library, however,
once you do, you will find it's an invaluable resource to aid you throughout your ASP.NET
learning experience. The .NET MSDN library can be found at
http://msdn.microsoft.com/net/
Complete Compatibility
One of the most important goals of .NET was to allow developers to write an ASP.NET
application using multiple programming languages. As long as each ASP.NET page contains
only one programming language, you can mix and match different pages using different
languages and they will work together seamlessly. This means you can now have a team of
developers with half programming in C#, and the other half in VB.NET, with no need to
worry about language incompatibilities, etc.
A cool little side-affect of all this is that all the programming languages look very similar,
and differ only by their language syntax.
Take the following code snippets for example. They both do exactly the same thing but the
first is written in C#, and the second in VB.NET.
The C# version:
void Page_Load(Object S, EventArgs E) { myLabel.Text = "Hello world!!";
</script>
The VB.NET version:
Sub Page_Load(S As Object, E As EventArgs) myLabel.Text = "Hello world!!"
End Sub
</script>
If you take either of the code examples shown above and add the following HTML to them,
then they would both run perfectly inside of an ASP.NET page:
<head>
<title>"Hello World" example!</title>
</head>
<body>
<asp:Label id="myLabel" runat="server" />
</body>
</html>

Potrebbero piacerti anche