asp.net introduction

advertisement
Pemrograman Web
ASP.NET Basic
.NET
.NET Platform untuk developer
1. Language Independent
2. Interoperability dan kompabilitas antar aplikasi
3. Kemudahan migrasi dari teknologi yang ada saat ini
4. Full support terhadap teknologi standar dalam platform internet
(HTTP, XML, SOAP, HTML)
Teknologi inti .NET
1. .NET Framework
2. .NET Building Block Services
3. Visual Studio .NET
4. NET Enterprise Server
C++
VB®
C# JScript®
…
ASP.NET: Web
services
Windows
For ms
ADO.NET: Data and XML
Base class librar y
Visual Studio® .NET
Common language specification
Common language runtime
Keuntungan .NET
n
Multi Language
n
No. DLL Hell
n
Strong Typing dan Type Safety
n
Cross Platform Possibility
n
Code Once, More Application
Aas Meinardi, S.Si
Hal 1
Pemrograman Web
ASP.NET Basic
ASP.NET INTRODUCTION
ekstension file = .aspx
Teknologi ASP.NET:
1. Akses terhadap .NET Framework secara powerful dan konsisten
2. Penggunaan berbagai bahasa pemrograman secara penuh
(VB.NET,C#,J#,etc)
3. Web Control
4. Code Behind
Persiapan
1. OS Windows XP/NT/2000/Vista + Internet Information Service (IIS)
2. Microsoft .NET Framework 2.0
3. Database SQL Server 2005
4. Editor: Visual Studio / Visual Web Developer 2005
ASP.NET PAGE STRUCTURE
n
Directives
n
Code declaration blocks
n
Code render blocks
n
ASP.NET server controls
n
Server-side comments
n
Server-side include directives
n
Literal text and HTML tags
directive
Code
declaration
block
ASP.NET
Control
Server Side
Comment
Code Render
Block
Aas Meinardi, S.Si
Hal 2
Pemrograman Web
ASP.NET Basic
Directives
<%@ Page Language="C#" %>
Jenis Directive a.l:
Page
Mendefinisikan atribut dari halaman ASP.NET, seperti jenis
bahasa pemrograman yg digunakan.
Import
Memakai namespaces.
Register
Link halaman ASP.NET dengan user control.
Contoh:
<%@ Import Namespace="System.Web.Mail" %>
<%@ Register TagPrefix="uc" TagName="footer" Src="footer.ascx" %>
Code Declaration Blocks
<script runat="server">
Void mySub()
{
' Code here
}
</script>
<script runat="server" language="C#">
<script runat="server" language="C#" src="mycodefile.cs">
Contoh:
<script runat="server">
Void Page Load()
{
lblMessage.Text = "Hello World";
}
</script>
Code Render Blocks
Contoh:
<% string salam = "Apa kabar"%>
<%= salam %>
Aas Meinardi, S.Si
Hal 3
Pemrograman Web
ASP.NET Basic
ASP.NET Server Controls / Web Controls
<asp:control_name id="some_id" runat="server" />
Contoh:
<asp:Label id="Label1" runat="server">Label</asp:Label>
Server-Side Comments
Contoh:
<%-- Deklarasi variabel dan set nilai tulisan --%>
Server-Side Include Directives
<!-- #INCLUDE file="myinclude.aspx" -->
<!-- #INCLUDE virtual="/directory1/myinclude.aspx" -->
Literal Text and HTML Tags / HTML Control
Contoh:
<%@ Page Language="C#" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = "Hallo";
}
</script>
<html>
<head>
<title>Contoh Halaman ASP.NET</title>
</head>
<body>
<form runat="server">
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<%-- Deklarasi variabel dan set nilai tulisan --%>
<% string salam = "Apa Kabar"; %>
<%= salam %>
</form>
</body>
</html>
Aas Meinardi, S.Si
Hal 4
Download