Sunday, June 29, 2008

Asp Dotnet vs Asp

ASP.NET has better language support, a large set of new controls and XML based components, and better user authentication.

ASP.NET provides increased performance by running compiled code.

ASP.NET code is not fully backward compatible with ASP.


--------------------------------------------------------------------------------

New in ASP.NET
Better language support
Programmable controls
Event-driven programming
XML-based components
User authentication, with accounts and roles
Higher scalability
Increased performance - Compiled code
Easier configuration and deployment
Not fully ASP compatible

--------------------------------------------------------------------------------

Language Support
ASP.NET uses the new ADO.NET.

ASP.NET supports full Visual Basic, not VBScript.

ASP.NET supports C# (C sharp) and C++.

ASP.NET supports JScript as before.


--------------------------------------------------------------------------------

ASP.NET Controls
ASP.NET contains a large set of HTML controls. Almost all HTML elements on a page can be defined as ASP.NET control objects that can be controlled by scripts.

ASP.NET also contains a new set of object oriented input controls, like programmable list boxes and validation controls.

A new data grid control supports sorting, data paging, and everything you expect from a dataset control.


--------------------------------------------------------------------------------

Event Aware Controls
All ASP.NET objects on a Web page can expose events that can be processed by ASP.NET code.

Load, Click and Change events handled by code makes coding much simpler and much better organized.


--------------------------------------------------------------------------------

ASP.NET Components
ASP.NET components are heavily based on XML. Like the new AD Rotator, that uses XML to store advertisement information and configuration.


--------------------------------------------------------------------------------

User Authentication
ASP.NET supports forms-based user authentication, including cookie management and automatic redirecting of unauthorized logins.

(You can still do your custom login page and custom user checking).


--------------------------------------------------------------------------------

User Accounts and Roles
AS .NET allows for user accounts and roles, to give each user (with a given role) access to different server code and executables.


--------------------------------------------------------------------------------

High Scalability
Much has been done with ASP.NET to provide greater scalability.

Server to server communication has been greatly enhanced, making it possible to scale an application over several servers. One example of this is the ability to run XML parsers, XSL transformations and even resource hungry session objects on other servers.


--------------------------------------------------------------------------------

Compiled Code
The first request for an ASP.NET page on the server will compile the ASP.NET code and keep a cached copy in memory. The result of this is greatly increased performance.


--------------------------------------------------------------------------------

Easy Configuration
Configuration of ASP.NET is done with plain text files.

Configuration files can be uploaded or changed while the application is running. No need to restart the server. No more metabase or registry puzzle.


--------------------------------------------------------------------------------

Easy Deployment
No more server restart to deploy or replace compiled code. ASP.NET simply redirects all new requests to the new code.


--------------------------------------------------------------------------------

Compatibility
ASP.NET is not fully compatible with earlier versions of ASP, so most of the old ASP code will need some changes to run under ASP.NET.

To overcome this problem, ASP.NET uses a new file extension ".aspx". This will make ASP.NET applications able to run side by side with standard ASP applications on the same server.

Friday, June 27, 2008

Asp Dotnet Server Control

Server controls are tags that are understood by the server.
Limitations in Classic ASP

The listing below was copied from the previous chapter:




Hello W3Schools!


<%Response.Write(now())%>






The code above illustrates a limitation in Classic ASP: The code block has to be placed where you want the output to appear.

With Classic ASP it is impossible to separate executable code from the HTML itself. This makes the page difficult to read, and difficult to maintain.
ASP.NET - Server Controls

ASP.NET has solved the "spaghetti-code" problem described above with server controls.

Server controls are tags that are understood by the server.

There are three kinds of server controls:

* HTML Server Controls - Traditional HTML tags
* Web Server Controls - New ASP.NET tags
* Validation Server Controls - For input validation

ASP.NET - HTML Server Controls

HTML server controls are HTML tags understood by the server.

HTML elements in ASP.NET files are, by default, treated as text. To make these elements programmable, add a runat="server" attribute to the HTML element. This attribute indicates that the element should be treated as a server control. The id attribute is added to identify the server control. The id reference can be used to manipulate the server control at run time.

Note: All HTML server controls must be within a
tag with the runat="server" attribute. The runat="server" attribute indicates that the form should be processed on the server. It also indicates that the enclosed controls can be accessed by server scripts.

In the following example we declare an HtmlAnchor server control in an .aspx file. Then we manipulate the HRef attribute of the HtmlAnchor control in an event handler (an event handler is a subroutine that executes code for a given event). The Page_Load event is one of many events that ASP.NET understands:







Visit W3Schools!





The executable code itself has been moved outside the HTML.
ASP.NET - Web Server Controls

Web server controls are special ASP.NET tags understood by the server.

Like HTML server controls, Web server controls are also created on the server and they require a runat="server" attribute to work. However, Web server controls do not necessarily map to any existing HTML elements and they may represent more complex elements.

The syntax for creating a Web server control is:



In the following example we declare a Button server control in an .aspx file. Then we create an event handler for the Click event which changes the text on the button:







runat="server" OnClick="submit"/>






ASP.NET - Validation Server Controls

Validation server controls are used to validate user-input. If the user-input does not pass validation, it will display an error message to the user.

Each validation control performs a specific type of validation (like validating against a specific value or a range of values).

By default, page validation is performed when a Button, ImageButton, or LinkButton control is clicked. You can prevent validation when a button control is clicked by setting the CausesValidation property to false.

The syntax for creating a Validation server control is:



In the following example we declare one TextBox control, one Button control, and one RangeValidator control in an .aspx file. If validation fails, the text "The value must be from 1 to 100!" will be displayed in the RangeValidator control:





Enter a number from 1 to 100:








ControlToValidate="tbox1"
MinimumValue="1"
MaximumValue="100"
Type="Integer"
Text="The value must be from 1 to 100!"
runat="server" />





Asp Dotnet

A simple ASP.NET page looks just like an ordinary HTML page.


Hello W3Schools

To start learning ASP.NET, we will construct a very simple HTML page that will display "Hello W3Schools" in an Internet browser like this:

Hello W3Schools!



Hello W3Schools in HTML

This code displays the example as an HTML page:





Hello W3Schools!




If you want to try it yourself, save the code in a file called "firstpage.htm", and create a link to the file like this: firstpage.htm


Hello W3Schools in ASP.NET

The simplest way to convert an HTML page into an ASP.NET page is to copy the HTML file to a new file with an .aspx extension.

This code displays our example as an ASP.NET page:





Hello W3Schools!




If you want to try it yourself, save the code in a file called "firstpage.aspx", and create a link to the file like this: firstpage.aspx


How Does it Work?

Fundamentally an ASP.NET page is just the same as an HTML page.

An HTML page has the extension .htm. If a browser requests an HTML page from the server, the server sends the page to the browser without any modifications.

An ASP.NET page has the extension .aspx. If a browser requests an ASP.NET page, the server processes any executable code in the page, before the result is sent back to the browser.

The ASP.NET page above does not contain any executable code, so nothing is executed. In the next examples we will add some executable code to the page to demonstrate the difference between static HTML pages and dynamic ASP pages.


Classic ASP

Active Server Pages (ASP) has been around for several years. With ASP, executable code can be placed inside HTML pages.

Previous versions of ASP (before ASP .NET) are often called Classic ASP.

ASP.NET is not fully compatible with Classic ASP, but most Classic ASP pages will work fine as ASP.NET pages, with only minor changes.

If you want to learn more about Classic ASP, please visit our ASP Tutorial.


Dynamic Page in Classic ASP

To demonstrate how ASP can display pages with dynamic content, we have added some executable code (in red) to the previous example:





Hello W3Schools!


<%Response.Write(now())%>




The code inside the <% --%> tags is executed on the server.

Response.Write is ASP code for writing something to the HTML output stream.

Now() is a function returning the servers current date and time.

If you want to try it yourself, save the code in a file called "dynpage.asp", and create a link to the file like this: dynpage.asp


Dynamic Page in ASP .NET

This following code displays our example as an ASP.NET page:





Hello W3Schools!


<%Response.Write(now())%>




If you want to try it yourself, save the code in a file called "dynpage.aspx", and create a link to the file like this: dynpage.aspx


ASP.NET vs Classic ASP

The previous examples didn't demonstrate any differences between ASP.NET and Classic ASP.

As you can see from the two latest examples there are no differences between the two ASP and ASP.NET pages.

In the next chapters you will see how server controls make ASP.NET more powerful than Classic ASP.

Wednesday, June 25, 2008

Dotnet

This introduction describes what .NET is and what it holds for the future.

Microsoft .NET Core Building Blocks
This chapter describes the core building blocks of Microsoft .NET.

Microsoft .NET Software
This chapter describes .NET development tools, software, standards and applications

Web Services
This chapter describes the concept of Web Services.

Client and Server Standards
W3Schools' own vision about .NET Client and Server Standards

Applications must be Services
W3Schools' own vision about .NET Application Services

Future Proof Applications
W3Schools' own vision about .NET and Future Proof Internet Applications