Aplikacje sieciowe
Aplikacje webowe podstawy
ASP.NET
Struktura strony aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text="Wprowadz wartość"></asp:Label>
<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<asp:Button ID="ZatwierdzButton" runat="server" Text="Zatwierdź" onclick="ZatwierdzButton_Click" />
</div>
</form>
</body>
</html>
Struktura strony aspx - plik cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Default2 : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
}
protected void ZatwierdzButton_Click(object sender, EventArgs e) {
} }
Struktura aplikacji ASP.NET
Plik web.config i machine.config
<!--
Note: As an alternative to hand editing this file you can use the web admin tool to configure settings for your application. Use the Website->Asp.Net Configuration option in Visual Studio. A full list of settings and comments can be found in
machine.config.comments usually located in C: \Windows\Microsoft.Net\Framework\v2.x\Config -->
<configuration>
<appSettings> <appSettings/>
<connectionStrings> <connectionStrings/>
<system.web>
<compilation debug="true">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
<compilation/>
<authentication mode="Windows"/>
<system.web>
</configuration>
Podstawowe Kontrolki Serwerowe
Podstawowe Kontrolki Serwerowe cd.
Uruchomienie aplikacji
Podstawowe Zdarzenia.
Obsługa kolejnych odwołań do strony
protected void Page_Load(object sender, EventArgs e) {
if (!IsPostBack) {
...
} }
protected void ZatwierdzButton_Click(object sender, EventArgs e) {
Label1.Text = "Hello World"; ....
}