inicio mail me! sindicaci;ón

ASP.NET instantly begin tutorial (1)

One, begin

1, introduce

Welcome to ASP.NET instantly begin tutorial.

ASP.NET instantly begin tutorial is formed by a series of example and supportive explanation, his purpose is to make developer fast understand the grammar of ASP.NET, frame and ASP.NET network to use the powerful function of program frame. What all example design is smallish and the look is intelligible, can reveal the corresponding function of ASP.NET adequately. After learning this tutorial, you should be familiar with the following content:

·ASP.NET grammar. Of course, to skilled ASP developer, element of some ASP.NET grammar will be very familiar, and some are new framework place is particular however. The example of this tutorial enclothed the detail of all syntactic elements.

·ASP.NET structure and character. This tutorial introduces the character of ASP.NET, these character can let developer establish alternant formula with unprecedented efficiency, the applied process of world-class level.

· optimal practice. The example of this tutorial set an example the optimal way of ASP.NET function, also prevented potential defect at the same time.

The readership target level of this teaching material asks:

If the experience that develops Web page never passes before you, so this teaching material does not suit you. You should be familiar with Html and average Web development term. You do not need to had had the experience of Asp, but the concept that you should be familiar with seesaw pattern page, include to express sheet, script and data are visited.

Digest the example that draws this teaching material

This teaching material is the optimal practice that reveals content. Every example is built the differentiate and analyse in the concept and in front over the extend the meaning of example. This example is one conforms to the principle of simplicity sheet arrives complex, arrive from onefold technology whole set of application

2, what is ASP.NET

Asp.net is to build hour library moves in universal language (CLR) the applied process frame that go up. He uses upright compose to propose the Web application program with powerful function. Asp.net offerred a few to surpass the good point that Web develops pattern before:

The performance that · enhances. Asp.net is the after compiling CLR code that moves in server end, is not to resemble ASP explaining in that way carry out. Asp.net is used bind ahead of schedule calm, compile immediately, this locality is optimized and cache service improves performance. All all these, function is more than each code that you write before far.

The development tool of · world-class level supports. The compositive development environment in Visual Studio.net (IDE) in, asp.net frame is mixed by rich kit design implement composition. Be seen namely of earning (WYSIWYG) editor means, procrastinate put a server to accuse, and automatic deploy, it is the function of one little part that place of this one powerful tool provides merely.

· is powerful and rich flexibility. Because Asp.net is to be based on (of CLR) , because of this whole.net platform mix formidably rich flexibility, likewise OK at developer of Web application process applying. Kind of library of.net frame, message and data visit a solution, can not have seam compositive to Web. Asp.net also is the language is indifferent, accordingly you can choose your most familiar language, perhaps complete an application jointly through a few kinds of languages. And, when the each other of CLR can make sure with the gender you upgrade to Asp.ent, the existent development investment that is based on COM still is withheld.

· is simple. Asp.net makes carry out commonly used job to become very easy, from simple table for instance sheet is referred, the client carries test and verify, to deploy and site configuration. For example, asp.net allows you to build user port, realize the depart of page and logistic code, in the meantime, odd like the watch of Vb executive mode handles incident in that way (that is to say, turned incident drive into mode by page drive mode) . In addition, CLR simplified deploy, use administrative code service, consult automatically to reclaim with rubbish for example.

· manages easily. Asp.net uses to be based on text, the configuration system that distributes administrative levels, it simplified the setting that the server carries environment and Web application program. Because configure information to be saved with simple text format, new setting does not need the support of tool of this locality government. The concept that 0 this locality of this kind of “ support ” applied deploy Asp.net to use a program as much. Asp.net applies program deploy to the server, the file with brief duplicate and necessary melt into arrives server. In deploy, when replacing the mutation code that moving even, also do not need to start a server afresh.

· but retractility and use a sex effectively. Asp.net is become by the design stretch, can be group and multiprocessing implement environmental design improves performance. And, asp.net moves to hour monitors closely and run a course, such, if produced wrong action, for example flaw and dead lock, new process can be built in current position, the applied process that will help you continues to handle incident to request.

· can be ordered make and expand. Asp.net offers a kind of good augment structure, allow developer to insert ” in proper level “ their code. In fact, the write component that uses his can expand or replace Asp.net to run hour any child package. Carry out what become unprecedented from definition test and verify or state service is easy.

· security. Built-in Windows test and verify and each independence that use a program are configured, you can think your applied process is safe.

Next Asp.net tutorial force practices what show these ideas to you

3, the language supports (C# version)

Language support

The.net platform of Microsoft provides support of built-in 3 kinds of languages now: C# , visual Basic, with Jscript. The exercise of this teaching material and example code are revealed how to use these 3 kinds of languages to establish.net application program. Get syntactic information about the more of other language, ask documentation of referenced.NET Framework SDK.

Offer below code paragraph example of the code in helping you understand this teaching material, and the difference between these 3 kinds of languages.

Variable statement

It is quotative content below: Int X;
String S;
String S1, s2;
Object O;
Object Obj = New Object();Public String Name;

Statement

Response.Write(”foo” );

Annotate

/ / this is one-way annotate

/ * this is */ of much travel annotate

Visit index attribute

It is quotative content below:
String S = Request.QueryString[”Name” ];
String Value = Request.Cookies[”key” ];

Statement reference attribute

It is quotative content below:
/ / Default Indexed PropertyPublic String This[String Name] {Get {Return (String) Lookuptable[name];
}
}

Statement is simple attribute

It is quotative content below:

Public String Name {

Get {
. . . Return. . . ;
}

Set {
. . . = Value;
}

}

State and use enumerate

It is quotative content below:

/ / Declare The EnumerationPublic Enum MessageSize {

Small = 0,
Medium = 1,
Large = 2
}

/ / Create A Field Or PropertyPublic MessageSize Msgsize;

/ / Assign To The Property Using The Enumeration ValuesMsgsize = Small;

All over all previous gather

It is quotative content below: Foreach (String S In Coll) {
. . .
}

State and use a method

It is quotative content below:

/ / Declare A Void Return FunctionVoid Voidfunction() {
. . .
}

/ / Declare A Function That Returns A Value
String Stringfunction() {
. . . Return (String) Val;
}

/ / Declare A Function That Takes And Returns Values
String Parmfunction(String A, string B) {
. . . Return (String) (a B);
}

/ / Use The FunctionsVoidfunction();
String S1 = Stringfunction();
String S2 = Parmfunction(”Hello” , “World! “) ;

Custom-built attribute

It is quotative content below:

/ / Stand-alone Attribute
[STAThread]

/ / Attribute With Parameters
[DllImport(”ADVAPI32.DLL” ) ]

/ / Attribute With Named Parameters
[DllImport(”KERNEL32.DLL” , charSet=CharSet.Auto) ]

Array

It is quotative content below:

String[] A = New String[3];A[0] = “1″ ;A[1] = “2″ ;A[2] = “3″ ;

String[][] A = New String[3][3];A[0][0] = “1″ ;A[1][0] = “2″ ;A[2][0] = “3″ ;

Initialization

It is quotative content below:
String S = “Hello World” ;Int I = 1;Double[] A = {3.00, 4, 5.00};
If statement If (Request.QueryString! = Null) {
. . .
}

Case statement

It is quotative content below:

Switch (FirstName) {Case “John” :
. . . Break;Case “Paul” :
. . . Break;Case “Ringo” :
. . . Break;Default:
. . . Break;
}

For circulates For (int I=0; I<3; I )A(i) = “test” ;
While circulates Int I = 0;While (i<3) {
Console.WriteLine(i.ToString());I = 1;
}

Unusual processing

It is quotative content below: Try {
/ / Code That Throws Exceptions
} Catch(OverflowException E) {
/ / Catch A Specific Exception
} Catch(Exception E) {
/ / Catch The Generic Exceptions
} Finally {
/ / Execute Some Cleanup Code
}

String joins

It is quotative content below:

/ / Using Strings
String S1;
String S2 = “hello” ;S2 = ” World” ;S1 = S2 ” ! ! ! “;

/ / Using StringBuilder Class For Performance
StringBuilder S3 = New StringBuilder();S3.Append(”hello” );S3.Append(” World” );S3.Append(” ! ! ! “) ;

Incident handles accreditation

It is quotative content below: Void MyButton_Click(Object Sender,
EventArgs E) {
. . .
}

Statement incident

It is quotative content below:

/ / Create A Public EventPublic Event EventHandler MyEvent;

/ / Create A Method For Firing The EventProtected Void OnMyEvent(EventArgs E) {
MyEvent(this, e);
}

Increase to incident or move to be handled except incident

It is quotative content below:
Control.Change = New EventHandler(this.ChangeEventHandler);
Control.Change -= New EventHandler(this.ChangeEventHandler);

Tectonic

It is quotative content below:
MyObject Obj = (MyObject)Session[”Some Value” ];
IMyObject IObj = Obj;

Changeover

It is quotative content below: Int I = 3;
String S = I.ToString();Double D = Double.Parse(s);

Contain kind of successive definition

It is quotative content below:

Using System;

Namespace MySpace {

Public Class Foo: Bar {

Int X;

Public Foo() {X = 4; }Public Void Add(int X) {This.x = X; }Override Public Int GetNum() {Return X; }
}

}

/ / Csc /out:lIbrarycs.dll /t:lIbrary
/ / Library.cs

Realize interface

It is quotative content below:

Public Class MyClass: IEnumerable {
. . .

IEnumerator IEnumerable.GetEnumerator() {
. . .
}
}

Contain kind of definition of Main method

It is quotative content below:

Using System;

Public Class ConsoleCS {

Public ConsoleCS() {
Console.WriteLine(”Object Created” );
}

Public Static Void Main (String[] Args) {
Console.WriteLine(”Hello World” );
ConsoleCS Ccs = New ConsoleCS();
}

}

/ / Csc /out:cOnsolecs.exe /t:eXe Console.cs

Standard pattern plate

It is quotative content below:

Using System;

Public Class Module {

Public Static Void Main (String[] Args) {
Console.WriteLine(”Hello World” );
}

}
/ / Csc /out:cOnsolecs.exe /t:eXe Console.cs

Bookmark:Digg Del.icio.us Reddit

Leave a Comment