Sunday, March 24, 2013

ASP.NET 4. 0 Introduction

learn asp.net



 Introduction to ASP.NET  4. 0


ASP.NET is the name of the Microsoft technology used for web site development.
ASP.NET is NOT a programming language like C# or VB.NET
ASP.NET development requires a programming language like C# or VB.NET to write code.
ASP stands for Active Server Pages.
There are several other technologies exist for web development (Eg: PHP). ASP.NET is the technology from Microsoft and it he widely used one.
ASP.NET technology comes with a rich set of components and controls that make the web development very easy.
Visual Studio .NET is the editor from Microsoft which helps you develop ASP.NET web sites faster and easily. 
In ASP.NET programming, a web page is developed using HTML and a .NET programming language like C#, VB.NET or J#. You can choose your favourite .NET language to develop ASP.NET pages.

Creating a new Website

First step in creating a new website is to open the application  VISUAL STUDIO 2010. The second one is to select  ”New Web Site”  from File tab. You can select ASP.NET WebSite or Empty WebSite. ASP.NET WebSite will appear with a Master page and almost gives the structure of a website. But there is unnessary things which we dont want in our site. So it’s better to create an Empty WebSite rather than modifying an existing site.

From the newer menu select the programming language  (Visual Basic or Visual C#). We will select the location where do we want to create the website  (it can also be a FTP address) and the type of the website. 

Displaying The Interface

In the upper left side, in Toolbox you will find all the controls that can be added into a website.
In Server Explorer you can see the database attached to the website  (in this moment it isn’t attached ).
In center you can see the visual side of the website .
In the right side you find the Solution Explorer where you can see all the files of the website  and Properties where you find the properties of the selected object.
Site.Master (a page of the website)--- Using this you will build the other pages, adding  just content letting the design intact.
To add a new page go to Website menu and select Add New Item. Will appear a new window from where you can select the type of the page and the name.
To view the website on localhost you have to select from the menu  Debug and Start Debugging.
The database and the tables where will be saved users names and details about them will be created automatically.
After you create a new page will be created a new file .cs where will be written the codes



Server side Scripting
The  dynamic pages are created using code in asp.net web pages. When you request a page, the web server executes the code in the web page and generates an HTML content for that page. It is this HTML content that is sent back to the browser so that it can be displayed to the user.

The code that is executed by the web server to generate the dynamic page is called "server side code". It is called "server side code" because it is executed by the web server.

When you develop ASP.NET pages, you will use C# or VB.NET (or any other .NET compatible code) code to write the server side code. Server side code is used to retrieve and generate content for the dynamic pages. You may be using the code to retrieve the content from database or something like that.

When a dynamic page is requested, the server side code is executed on the server and a page is generated. Once the generated page comes to the browser, there is connection with the server. You cannot do anything from the browser to communicate with the server, othen than requesting another page or same page again. So, if you want to access the database or something like that once the page is displayed, it is not possible.
Client side scripting


Client side code is used to do some kind of basic operations in the browser when the page is displayed to the user.

As you read above, it is not possible to access the server once the page is displayed. Morover, the browser does not know anything about ASP.NET or .NET. The browser understands only HTML and client side scripting languages.

Client side coding is used to do basic operations on the browser. It cannot be used to access the server or database on the server etc.

Client side coding is done using scripting languages like Javascript, VbScript, JScript etc. These scripting languages are easy to learn (they are different from vb.net and C#). The scripting languages provide only very minimal functionality.

The main use of client side scripting is to validate user input before submitting a page to server. For example, suppose you have a "Registration" page. Once user enter all data and press the "submit" button, all the user input will be sent to server. In the server side, you may have written vb.net or C# code to validate all user inputs like Name cannot be empty etc. If the user do not enter a name and press submit, your server side code will generate an error message and return the page to you.

In this case, the page was sent to the server and came back with an error message. It was an expensive operation. It consumed lot of resources to send a page to the server and get it back to the browser with an error message.

If we can catch this validation error in the browser itself, instead of sending to server and coming back with an error, that will save lot of time and resources. User need not wait to send the page to server and come back.

Since, a browser does not know VB.NET or C#, you cannot write such code to validate it in the browser.

Client side scripting comes here to help. You can write Javascript, VBScript or JScript code to validate the name field in the browser itself and submit it to the server only if all user inputs are correct.
JavaScript has the following unique features:
  • JavaScript is a scripting language - Source code is interpreted, instead of compiled and executed. Like most other interpreted languages, it does support the eval(source_code) function.
  • JavaScript is a dynamic typing language - Data types are associated with values, instead of variables. In other words, variables are declared without specific data types. They can be assigned with values of any data type.
  • JavaScript is a prototype-based language - Prototypes, instead of classes, are used for defining object properties, methods, and inheritance.
  • JavaScript uses associative arrays to represent objects - Property names and values are stored as associative array elements. Properties and their values can be added, changed, or deleted at run-time.
  • JavaScript supports functions as first-class functions - Functions are really objects. Like regular objects, functions can be created during execution, stored in data structure, and passed to other functions as arguments.

Eg: <html>
<head><title>Hello World! </title></head>
<body>
<script type="text/javascript">
   document.write('Hello World!');
</script>
</body>
</html>

HTML

HTML stands for the HyperText Markup Language. Web sites are created with the codes of the HTML language. HTML is extremely easy to learn, and it's completely free to code web sites with it. HTML allows web sites to bring together graphics, music, video and links. The HTML code you type can be viewed on any computer. If you type it on a Windows PC, it can be viewed on both Windows and Apple computers, and if you type it on an Apple Mac, you can view it on both Macs and PCs. It doesn't matter what computer someone uses, as long as it has Internet access.

web server

A Web server is a software program which serves web pages to web users (browsers).

A web server delivers requested web pages to users who enter the URL in a web browser. Every computer on the Internet that contains a web site must have a web server program.

The computer in which a web server program runs is also usually called a "web server". So, the term "web server" is used to represent both the server program and the computer in which the server program runs.

Characteristics of web servers

A web server computer is just like any other computer. The basic characteristics of web servers are:

- It is always connected to the internet so that clients can access the web pages hosted by the web server.
- It has an application called 'web server' running always.

In short, a 'web server' is a computer which is connected to the internet/intranet and has a software called 'web server'. The web server program will be always running in the computer. When any user try to access a website hosted by the web server, it is actually the web server program which delivers the web page which client asks for.

A web server can hosted hundreds of web sites. Most of the small web sites in the internet are hosted on shared web servers. 
Examples of web server applications

1. IIS
2. Apache

ASP.NET Web Forms 4.0 at a Glance

The key words to describe what's new in the overall ASP.NET 4.0 platform are "more control." ASP.NET 4.0 is neither a revolutionary change nor a refactoring of its existing architecture. It consists, instead, of a good number of small-scale changes that together provide developers with much more control of certain frequently used features of the existing framework.
For example, ASP.NET 4.0 Web Forms give developers more control over viewstate management, generation of IDs in the context of data-bound controls, and HTML generated by some template-based controls. In addition, you'll find new families of pluggable components for features that weren't supporting the provider 2009 model in earlier versions of ASP.NET and a finer control over the linking of external script files through the ScriptManager control.

More notes visit 

0 comments:

Post a Comment