انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة

Working with ASP.NET

الكلية كلية تكنولوجيا المعلومات     القسم قسم شبكات المعلومات     المرحلة 2
أستاذ المادة حۡــسۜــنۨ ا̍ڷــڔهــٻۧــمۘــې       3/5/2012 4:54:39 PM
An ASP.NET Web Forms page consists of a user interface and programming logic. The user interface helps display information to users, while the programming logic handles user interaction with the Web Forms pages.


The user interface consists of a file containing a markup language, such as HTML or XML, and server controls. This file is called a page and has .aspx as its extension.The functionality to respond to user interactions with the Web Forms pages is implemented by using programming languages, such as Visual Basic .NET and C#.
You can implement the programming logic in the ASPX file or in a separate file written in any CLR-supported language, such as Visual Basic .NET or C#. This separate file is called the code behind file and has either .aspx.cs or .aspx.vb as its extension depending on the language used. Thus, a Web Forms page consists of a page (ASPX file) and a code behind file (.aspx.cs file or .aspx.vb file).

Hello Babylon 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:
<html>
<body bgcolor="yellow">
<center>
<h2>Hello Babylon!</h2>
</center>
</body>
</html>

Note : If you want to try it yourself, save the code in a file called "firstpage.aspx", then run it inside the MS Visual Studio

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.


Dynamic Page in ASP .NET

To demonstrate how ASP.NET can display pages with dynamic content, we have added some executable code

<html>
<body bgcolor="yellow">
<center>
<h2>Hello Babylon!</h2>
<p><%Response.Write(now())%></p>
</center>
</body>
</html>
Explaining the Example :

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.aspx"

المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .