Beruflich Dokumente
Kultur Dokumente
NET
Some references:
What is .NET?
trimmed version before execution. All .NET languages are compiled to MSIL
the common language of .NET
The CLR- common language runtime; responsible for executing MSIL code;
interfaces to Windows and IIS
A rich set of libraries (Framework Class Libraries) available to all .NET
languages
The .NET languages such as C#, VB.NET etc that conform to CLR
ASP.NET is how the Framework is exposed to the web, using IIS to manage
simple pages of code so that they can be complied into full .NET programs.
These generate HTML for the browser.
Common Language
Runtime Type System
Compilers use the runtime type system to
produce type compatible components
Components
C#
VB
C++
Compilers
Runtime Environment
MSIL
No interpreter
Install-time or run-time IL tonative compilation
Evidence-based security
Native
Code
VC
...
Script
IL
Native
Code
Framework Overview
VB
C++
C#
JScript
Win Forms
Visual Studio.NET
Web Forms
(ASP.NET)
System.Web
Web Services
Web Forms
Controls
Drawing
XML
SQL
Threading
IO
Net
Security
ServiceProcess
Metadata
Execution
Namespace
The base class libraries are organized into logical
groupings of code called namespaces
A namespace is a hierarchical way to identify
resources in .NET
The System object is at the top of the namespace
hierarchy, and all objects inherit from it
ASP.NET: System.Web namespace
WebForms: System.Web.UI namespace
HTML Server Controls:
System.Web.UI.Control.HTMLControl
ASP.NET Server Controls:
System.Web.UI.Control.WebControl
Importing Namespaces
Visual Studio .NET adds references to your projects
commonly used namespaces by default
You can import the namespaces into your page using
the @Import directive
The following is the syntax for importing a .NET
namespace
<%@ Import NamespaceName %>
System.Collections
System.IO
System.Web
Support browser/server
communication
System.Web.UI
ASP.NET
The latest version of ASP is known as ASP.NET
Visual Studio .NET is a developer application used to
create ASP.NET Web applications
There are two main types of Web resources created
with ASP.NET applications
WebForms are ASP.NET pages within an ASP.NET
application
Web Services are ASP.NET Web pages that contain
publicly exposed code so that other applications can
interact with them
Web Services are identified with the file extension .asmx
WebForms
The ASP.NET WebForm is separated into two
logical areas:
The HTML template
A collection of code behind the WebForm
Server Controls
HTML Server controls are similar to the HTML
controls, except they are processed by the server
Add runat = "server" to the HTML control to transform
it into an HTML Server control
HTML control: <input type="text">
HTML Server control:
<input type="text" runat="server"/>
<input type=radio runat=server value=Yes/> Yes
ASP.NET Controls
ASP.NET form controls will create the HTML code
ASP.NET Server controls are organized as:
HTML Server Vs
ASP.NET Server, Controls
ASP.NET form controls can interact with client-side
events such as when the user clicks on a button
When the event occurs, ASP.NET can trigger a script to run
on the server
User Controls
User controls are external files that can be included within
another WebForm
User controls allow you to reuse code across multiple files
For example, you can create a user control that displays
the a navigation bar
You can use this control on the home page; they are often
used for creating self-contained code, headers, menus, and
footers
User controls replace the functionality of ASP server-side
include pages
They are identified with the file extension .asmx
Mobile controls
A series of controls that provide form functionality within wireless
and mobile devices
Literal controls
Page content that is not assigned to a specific HTML control such as
a combination of HTML tags and text to the browser
Server_Controls
Page_prerender
Page_Unload
Web Services
Web Services also provide a means to
expose .NET functionality on the web but
Web Services expose functionality via XML
and SOAP (cf: function calls over the web)
Web Services
ASP.NET samples
Page directives: <%@ page language = VB
debug="true" trace="true %>
<script language = VB runat=server> VB.NET
code declarations .. </script>
Message.aspx
<html>
<head> <title>Inserting ASP.NET code Example</title> </head>
<body>
Line1: First HTML Line<br />
Line2: Second HTML Line<br />
Line3: Third HTML Line<br />
</body>
</html>
Note this has no asp code so better to use .html extension
Message2.aspx
<script language="VB" runat="server">
Sub Page_Load()
Response.Write ("First ASP.NET Line<br />")
Response.Write ("Second ASP.NET Line<br />")
Response.Write ("Third ASP.NET Line<br />")
End Sub
</script>
<html> <head> <title>Inserting ASP.NET code Example</TITLE> </head>
<body>
Line1: First HTML Line<br />
Line2: Second HTML Line<br />
Line3: Third HTML Line<br />
</body>
</html>
Message3.aspx
html>
<head><title>Inserting ASP.NET code Example</title></head>
<body>
Line1: First HTML Line<br />
Line2: Second HTML Line<br />
Line3: Third HTML Line<br />
<script language="VB" runat="server">
Sub Page_Load()
Response.Write ("First ASP.NET Line<br />")
Response.Write ("Second ASP.NET Line<br />")
Response.Write ("Third ASP.NET Line<br />")
End Sub
</script>
</body>
</html>
Global.asax
Global.asax.resx
Global.asax.vb
Project.sln
Project.suo
Project.vbproj
Project.vsdisco
Styles.css
Web.config
Webform.aspx
Webform.aspx.resx
Webform.aspx.vb
Bin\project.dll
Bin\project.pdb
Examples
quickstart webforms
ASP.NET Vs PHP
Feature
PHP
ASP.NET
HTML
Yes
Yes
CSS
Yes
Yes
php Templates
Yes
UserControls
ServerControls
(buttons,grids etc)
No
Yes
Javascript
Yes
Database Conn
Yes
Yes
Yes
Yes
VIEWSTATE
No
Yes
POSTBACK
No
Yes