webform fundamental

80
Chương: 05 Web Form Fundamentals Lập trình Web Lập trình Web 1 Lập trình Web

Upload: cong-thanh-nguyen

Post on 12-Apr-2017

475 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: webform fundamental

Chương: 05Web Form Fundamentals

Lập trình Web Lập trình Web

1 Lập trình Web

Page 2: webform fundamental

Nội dungNội dungThe Anatomy of an ASP.NET ApplicationIntroducing Server ControlsLab1: Currency ConverterHTML Control ClassesPage ClassApplication EventsASP.NET Configuration

Lập trình Web 2

Page 3: webform fundamental

The Anatomy of an ASP.NET The Anatomy of an ASP.NET Application (1)Application (1)Mỗi ASP.NET website có thể xem như là một ứng dụngMỗi ứng dụng ASP.NET chạy trong một application domain

riêng.Các application domain là các vùng nhớ cô lập trong bộ nhớApplication domain giúp:

Các ứng dụng hoạt động độc lập, nếu ứng dụng này bị lỗi cũng không ảnh hưởng các ứng dụng khác.

Không cho ứng dụng này truy xuất thông tin bộ nhớ của ứng dụng kia.

Mỗi ứng dụng có cached, application data và session data riêng.

Lập trình Web 3

Page 4: webform fundamental

The Anatomy of an The Anatomy of an ASP.NET Application (2)ASP.NET Application (2)

Lập trình Web4

Page 5: webform fundamental

ASP.NET File typesASP.NET File typesFile Type Mô tả*.aspx Trang ASP.NET*.ascx ASP.NET user controls. *.asmx ASP.NET webservicesWeb.config File cấu hình cho ứng dụng web ASP.NET.

Chứa các cấu hình về bảo mật, quản lý trạng thái, quản lý bộ nhớ, ..vv..

Global.asax

Là file toàn cục, có thể dùng để khai báo các biến có phạm vi toàn ứng dụng (các biến application) và dùng để xử lý các sự kiện ở mức application

*.cs File source code (file code-behide), chứa mã nguồn xử lý phía server.

….. Lập trình Web 5

Page 6: webform fundamental

ASP.NET Application DirectoriesASP.NET Application DirectoriesTên Thư mục Mô tảBin Chứa các file DLL mà ứng dụng ASP.NET

sử dụng. App_Code Chứa các file source codeApp_GlobalResources

Chứa các resources có thể được truy xuất bởi mọi trang web trong ứng dụng.

App_LocalResources

Giống App_GlobalResource, ngoại trừ resource chỉ được truy xuất bởi một file cụ thể

App_WebReferences

Chứa tham chiếu tới các webservices

App_Data Chứa các file dữ liệu của website. (file xml, file database)

App_Themes Chứa các themes mà website sử dụng.Lập trình Web 6

Page 7: webform fundamental

Giới thiệu các Server ControlGiới thiệu các Server ControlServer Control:

Được tạo ra và cấu hình như các đối tượng.Chạy trên web server.Tự động sinh mã html để hiển thị dưới trình duyệt.Có thể lưu giữ trạng thái và phát sinh sự kiện giống window

controls.

Có 2 loại Server Control:HTML Server Control:Web Controls:

Lập trình Web 7

Page 8: webform fundamental

HTML Server ControlsHTML Server ControlsHTML Server Controls provide an object interface for

standard HTML elements

They provide three key features:They generate their own interfaceThey retain their stateThey fire server-side events

HTML server controls are ideal when you’re performing a quick translation to add serverside code to an existing HTML page

Lập trình Web 8

Page 9: webform fundamental

Converting an HTML Page to an Converting an HTML Page to an ASP.NET Page (1)ASP.NET Page (1)HTML page

Lập trình Web 9

Page 10: webform fundamental

Converting an HTML Page to an Converting an HTML Page to an ASP.NET Page (2)ASP.NET Page (2)ASP.NET page

Lập trình Web 10

Add Page directive

add the attribute runat="server" to transform into a server controls

Page 11: webform fundamental

Converting an HTML Page to an Converting an HTML Page to an ASP.NET Page (3)ASP.NET Page (3)

Lập trình Web 11

Page 12: webform fundamental

Notes:Notes:

The page directive gives ASP.NET basic information about how to compile the page. It indicates the language you’re using for your code and the way you connect your event handlers

ASP.NET controls are always placed inside the <form> tag of the page.

Lập trình Web 12

Page 13: webform fundamental

View State (1)View State (1)

Launch this web page in the browser.

Select View -> Source in your browser to look at the HTML that ASP.NET sent your way.

Lập trình Web 13

Page 14: webform fundamental

View State (2)View State (2)

Lập trình Web 14

Page 15: webform fundamental

View State (2)View State (2)

Lập trình Web 15

the runat="server" attributes are stripped out

Page 16: webform fundamental

View State (2)View State (2)

Lập trình Web 16

the runat="server" attributes are stripped out

an additional hidden field has been added to the form: ViewState

Page 17: webform fundamental

Notes:Notes:This hidden field stores information, in a compressed

format, about the state of every control in the page.

If you enter information in the text box and click the submit button to post the page, the refreshed page will still contain the value you entered in the text box.

This change occurs because ASP.NET controls automatically retain their state

Lập trình Web 17

Page 18: webform fundamental

The HTML Control ClassesThe HTML Control ClassesAll the HTML server controls are defined in the

System.Web.UI.HtmlControls namespace.

Each kind of control has a separate class.

Table in next slide describes the basic HTML server controls and shows you the related HTML element.

Lập trình Web 18

Page 19: webform fundamental

Lập trình Web 19

Class Name HTML ElementHtmlForm <form>HtmlAnchor <a>HtmlImage <img>HtmlTable, HtmlTableRow, and HtmlTableCel

<table>, <tr>, <th>,and <td>

HtmlInputButton,HtmlInputSubmit, andHtmlInputReset

<input type="button">,<input type="submit">,and <input type="reset">

HtmlButton <button>HtmlInputCheckBox <input type="checkbox">

Page 20: webform fundamental

Class Name HTML ElementHtmlInputText <input type="text">HtmlInputPassword <input

type="password">HtmlTextArea <textarea>HtmlInputImage <input type="image">HtmlInputFile <input type="file">HtmlInputHidden <input type="hidden">HtmlSelect <select>HtmlHead and HtmlTitle <head> and <title>HtmlGenericControl Any other HTML elementHtmlInputRadioButton <input type="radio">

Lập trình Web 20

Page 21: webform fundamental

Important HTML Control PropertiesImportant HTML Control PropertiesControl Most Important

PropertiesHtmlAnchor HRef, Name, Target, TitleHtmlImage Src, Alt, Align, Border,

Width, HeightHtmlInputCheckBox CheckedHtmlInputRadioButton CheckedHtmlInputText ValueHtmlTextArea ValueHtmlInputImage Src, Alt, Align, BorderHtmlSelect Items (collection)HtmlGenericControl InnerText and InnerHtmlLập trình Web 21

Page 22: webform fundamental

Adding the Currency Converter CodeAdding the Currency Converter CodeNotes:

Web forms are event-driven, which means every piece of code acts in response to a specific event

The HtmlInputButton allows you to react to this action by handling the ServerClick event.

Add a control that can display the result of the calculation. In this case, you can use a <div> tag named Result

Lập trình Web 22

<div style="font-weight: bold" ID="Result" runat="server"> ... </div>

Page 23: webform fundamental

Lập trình Web 23

Page 24: webform fundamental

Lập trình Web 24

File CurrencyConverter.aspx.cs

Page 25: webform fundamental

Event HandlingEvent HandlingWhen the user clicks the Covert button and the page is

sent back to the web server, ASP.NET needs to know exactly what code you want to run

To create this relationship and connect an event to an event-handling method, you need to add an attribute in the control tag

EX:

Lập trình Web 25

<input type="submit" value="OK" ID="Convert“ OnServerClick="Convert_ServerClick" runat="server">

Page 26: webform fundamental

Notes:Notes:The web page object that doesn’t use this attribute

system, because it doesn’t have a control Tag.

ASP.NET connects the web page events based on method names.

If you have a method named Page_Load() in your page class, and it has the right signature, ASP.NET connects this event handler to the Page.Load event automatically. This feature is called automatic event wireup.

Lập trình Web 26

Page 27: webform fundamental

Event HandlingEvent HandlingYou can connect events to evenhander using Code.

For example, here’s the code that’s required to hook up the ServerClick event of the Convert button using manual

event wireup:

Lập trình Web 27

Convert.ServerClick += this.Convert_ServerClick;

Page 28: webform fundamental

What really happens when ASP.NET receives a request for the

CurrencyConverter.aspx page???

Lập trình Web 28

Page 29: webform fundamental

Behind the Scenes with the Currency Behind the Scenes with the Currency ConverterConverter

1. First, the request for the page is sent to the web server.

2. The web server determines that the .aspx file extension is registered with ASP.NET and passes it to the ASP.NET worker process. If the file extension belonged to another service, ASP.NET would never get involved.

Lập trình Web 29

Page 30: webform fundamental

Behind the Scenes with the Currency Behind the Scenes with the Currency ConverterConverter

3. If this is the first time a page in this application has been requested, ASP.NET automatically creates the application domain.It also compiles all the web page code for optimum

performance, and caches the compiled files in the directory c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files

If this task has already been performed, ASP.NET will reuse the compiled version of the page.

Lập trình Web 30

Page 31: webform fundamental

Behind the Scenes with the Currency Behind the Scenes with the Currency ConverterConverter4. The compiled CurrencyConverter.aspx page acts like a

miniature program. It starts firing events. At this stage, everything is working together as a set of in-memory .NET objects.

5. When the code is finished, ASP.NET asks every control in the web page to render itself into the corresponding HTML markup.

6. The final page is sent to the user, and the application ends.

Lập trình Web 31

Page 32: webform fundamental

Lập trình Web 32

Page 33: webform fundamental

LabLab

Improving the Currency Converter

Lập trình Web 33

Page 34: webform fundamental

A Deeper Look at HTML A Deeper Look at HTML Control ClassesControl ClassesHTML Control InheritanceHTML Control EventsAdvanced Events with the HtmlInputImage ControlThe HtmlControl Base ClassThe HtmlContainerControl ClassThe HtmlInputControl Class

Lập trình Web34

Page 35: webform fundamental

HTML Control InheritanceHTML Control Inheritance

Lập trình Web 35

Page 36: webform fundamental

HTML Control EventsHTML Control EventsHTML server controls also provide one of two possible

events: ServerClick or ServerChangeThe ServerClick:

is simply a click that’s processed on the server sideIt’s provided by most button controls, and it allows your

code to take immediate actionThe ServerChange event:

Responds when a change has been made to a text or selection control

It doesn’t occur until the page is posted back

Lập trình Web 36

Page 37: webform fundamental

HTML Control EventsHTML Control EventsControls that provide ServerClick events:

HtmlAnchor, HtmlButton, HtmlInputButton, HtmlInputImage, HtmlInputReset

Controls that provide ServerChange events:HtmlInputText, HtmlInputCheckBox,

HtmlInputRadioButton, HtmlInputHidden, HtmlSelect, HtmlTextArea

Lập trình Web 37

Page 38: webform fundamental

Advanced Events with the Advanced Events with the HtmlInputImage ControlHtmlInputImage ControlEvery event should pass exactly two pieces of information to

event handler. The first parameter identifies the object (in this case, the control)

that fired the event.The second parameter is a special object that can include

additional information about the event.The second parameter (e) has always been used to pass an

empty System.EventArgs object.Only one HTML server control sends additional

information:the HtmlInputImage control. It sends an ImageClickEventArgs object that provides X and Y properties representing the location where the image was clicked.

Lập trình Web 38

Page 39: webform fundamental

Advanced Events with the Advanced Events with the HtmlInputImage ControlHtmlInputImage ControlEvent handler of HtmlInputButton control server click

event

Event handler of HTMLInputImage control Server click event

Lập trình Web 39

protected void Convert_ServerClick(Object sender, EventArgs e){ ... }

protected void ImgButton_ServerClick( Object sender, ImageClickEventArgs e){ ... }

Page 40: webform fundamental

Advanced Events with the Advanced Events with the HtmlInputImage ControlHtmlInputImage Control

Lập trình Web 40

<input type="image" ID="ImgButton" runat="server" src="button.png” OnServerClick="ImgButton_ServerClick" />

protected void ImgButton_ServerClick ( Object sender, ImageClickEventArgs e){ Result.InnerText = "You clicked at (" + e.X.ToString() + ", "

+ e.Y.ToString() + "). "; if ((e.Y < 100) && (e.Y > 20) && (e.X > 20) && (e.X < 275))

Result.InnerText += "You clicked on the button surface."; else

Result.InnerText += "You clicked the button border.";}

Page 41: webform fundamental

Lập trình Web 41

Page 42: webform fundamental

The HtmlControl Base ClassThe HtmlControl Base ClassEvery HTML control inherits from the base class

HtmlControl.

This relationship means that every HTML control will support a basic set of properties and features.

Table in next slide shows these properties

Lập trình Web 42

Page 43: webform fundamental

HTMLControl ‘s PropertiesHTMLControl ‘s PropertiesProperty DescriptionAttributes Provides a collection of all the attributes

that are set in the control tag,and their values.

Controls Provides a collection of all the controls contained inside the current control. Each object is provided as a generic System.Web.UI.Control object

Disabled Disables the control when set to true, thereby ensuring that the user cannot interact with it, and its events will not be fired

EnableViewState

Disables the automatic state management for this control when set to false.

Page Provides a reference to the web page that contains this control as a System.Web.UI.Page object

Lập trình Web 43

Page 44: webform fundamental

HTMLControl ‘s PropertiesHTMLControl ‘s PropertiesProperty DescriptionParent Provides a reference to the control that

contains this controlStyle Provides a collection of CSS style

properties that can be used to format the control

TagName Indicates the name of the underlying HTML element (for example, img or div).

Visible Hides the control when set to false and will not be rendered to the final HTML page that is sent to the client.

Lập trình Web 44

Page 45: webform fundamental

NotesNotesProperties can be set in code or in the tag.To set the initial value of a property,

you can configure the control in the Page.Load event handler, or you can adjust the control tag in the .aspx file by adding

special attributes.

Note that the Page.Load event occurs after the page is initialized with the default values and the tag settings.

If you set control properties in the Properties window, you are using the control tag approach

Lập trình Web 45

Page 46: webform fundamental

The HtmlContainerControl ClassThe HtmlContainerControl ClassAny HTML control that requires a closing tag inherits from

the HtmlContainer class.The HtmlContainer control adds two properties to those

defined in HtmlControl:InnerHtml: The HTML content between the opening and

closing tags of the control. Special characters will not be converted to the equivalent HTML entities.

InnerText: The text content between the opening and closing tags of the control. Special characters will be automatically converted to HTML entities and displayed like text. (for example, the less-than character (<) will be converted to &lt; and will be displayed as < in the web page).

Lập trình Web 46

Page 47: webform fundamental

The HtmlInputControl ClassThe HtmlInputControl ClassThis control defines some properties that are used for the

<input> element.

Type: Provides the type of input control. For example, a control based on <input type=”file”> would return file for the type property.

Value: Returns the contents of the control as a string. This property allowed the code to retrieve the information entered in the text input control

Lập trình Web 47

Page 48: webform fundamental

The Page ClassThe Page ClassSending the User to a New PageHTML Encoding

Lập trình Web48

Page 49: webform fundamental

The Page ClassThe Page ClassEvery web page is a custom class that inherits from

System.Web.UI.Page

Table in next slides provides an overview of some of the more fundamental properties of Page class

Lập trình Web 49

Page 50: webform fundamental

Basic Page PropertiesBasic Page PropertiesProperty DescriptionIsPostBack This Boolean property indicates whether this is

the first time the page is being run (false) or whether the page is being resubmitted in response to a control event, typically with stored view state information (true)

EnableViewState

When set to false, this overrides the EnableViewState property of the contained controls, thereby ensuring that no controls will maintain state information

Application This collection holds information that’s shared between all users in your website.

Session This collection holds information for a single user, so it can be used in different pages.

Cache This collection allows you to store objects that are time-consuming to create so they can be reused in other pages or for other clients.

Lập trình Web 50

Page 51: webform fundamental

Basic Page PropertiesBasic Page PropertiesProperty DescriptionRequest This refers to an HttpRequest object that

contains information about the current web request.

Response This refers to an HttpResponse object that represents the response ASP.NET will send to the user’s browser.

Server This refers to an HttpServerUtility object that allows you to perform a few miscellaneous tasks

User If the user has been authenticated, this property will be initialized with user information.

Lập trình Web 51

Page 52: webform fundamental

Sending the User to a New PageSending the User to a New PageThere are several ways to transfer a user from one page to

another.One of the simplest is to use an ordinary <a> anchor

element, which turns a portion of text into a hyperlink.

Another option is to send the user to a new page using code.

Lập trình Web 52

Click <a href="newpage.aspx">here</a> to go to newpage.aspx

Page 53: webform fundamental

Sending the User to a New PageSending the User to a New PageTo perform redirection in code, you first need a control

that causes the page to be posted back.

When the page is posted back and your event handler runs, you can use the HttpResponse.Redirect() or HttpServerUtility.Transfer()

method to send the user to the new page.

Lập trình Web 53

Page 54: webform fundamental

Using HttpResponse.Redirect()Using HttpResponse.Redirect()You can get access to the current HttpResponse object

through the Page.Response property.

When you use the Redirect() method, ASP.NET immediately stops processing the page and sends a redirect message back to the browser.

Any code that occurs after the Redirect() call won’t be executed.

Lập trình Web 54

Response.Redirect("newpage.aspx");

Page 55: webform fundamental

Using HttpResponse.Redirect()Using HttpResponse.Redirect()When the browser receives the redirect message, it sends

a request for the new page.

You can use the Redirect() method to send the user to any type of page.

Lập trình Web 55

Response.Redirect("http://www.prosetech.com");

Page 56: webform fundamental

Using HttpServerUtility.Transfer()Using HttpServerUtility.Transfer()An HttpServerUtility object is provided through the

Page.Server property, so your redirection code would look like this:

The advantage of using the Transfer() method is the fact that it doesn’t involve the browser.

Instead of sending a redirect message back to the browser, ASP.NET simply starts processing the new page as though the user had originally requested that page.

Lập trình Web 56

Server.Transfer("newpage.aspx");

Page 57: webform fundamental

Using HttpServerUtility.Transfer()Using HttpServerUtility.Transfer()This behavior saves a bit of time, but it also introduces

some significant limitations:You can’t use Transfer() to send the user to another website

or to a non-ASP.NET page (such as an HTML page).

The Transfer() method only allows you to jump from one ASP.NET page to another, in the same web application.

When you use Transfer() the user won’t have any idea that another page has taken over, because the browser will still show the original URL.

Lập trình Web 57

Page 58: webform fundamental

HTML EncodingHTML EncodingThere are certain characters that have a special meaning

in HTML.You can use the HttpServerUtility.HtmlEncode() method

to replace the special characters.

Lập trình Web 58

// Will output as "Enter a word &lt;here&gt;" in the HTML file, but the// browser will display it as "Enter a word <here>".ctrl.InnerHtml = Server.HtmlEncode("Enter a word <here>");

Page 59: webform fundamental

Lập trình Web59

ctrl.InnerHtml = "To <b>bold</b> text use the ";ctrl.InnerHtml += Server.HtmlEncode("<b>") + " tag.";

The results of successfully and incorrectly encoding special HTML characters

Page 60: webform fundamental

Along with the HtmlEncode() and HtmlDecode() methods,

the HttpServerUtility class also includes UrlEncode() and UrlDecode() methods. UrlEncode() allows you to convert text into a form that can be used in a URL.

Lập trình Web 60

Page 61: webform fundamental

Application EventsApplication EventsThe Global.asax FileAdditional Application Events

Lập trình Web61

Page 62: webform fundamental

Application EventsApplication EventsApplication events aren’t the events fired by server

controls.

These events fire at various points during the lifetime of a web application, including when the application domain is first created.

You can’t handle application events in the code behind for a web form. Instead, you need the help of another ingredient: the Global.asax file.

Lập trình Web 62

Page 63: webform fundamental

The Global.asax FileThe Global.asax FileThe Global.asax file allows you to write code that responds to global

application events.Each ASP.NET application can have one Global.asax file. Once you

place it in the appropriate website directory, ASP.NET recognizes it and uses it automatically.

To add a Global.asax file to an application in Visual Studio, choose Website => Add New Item, and select the Global Application Class file type. Then, click OK.

The Global.asax file looks similar to a normal .aspx file, except that it can’t contain any HTML or ASP.NET tags. Instead, it contains event handlers

Lập trình Web 63

Page 64: webform fundamental

For example, the following Global.asax file reacts to the Application.EndRequest event, which happens just before the page is sent to the user.

Lập trình Web 64

Page 65: webform fundamental

Lập trình Web 65

Page 66: webform fundamental

Additional Application EventsAdditional Application EventsEvent-Handling Method

Description

Application_Start() Occurs when the application starts, which is the first time it receives a request from any user. This event is commonly used to create or cache someinitial information that will be reused later.

Application_End() Occurs when the application is shutting down, generally because the web server is being restarted. You can insert cleanup code here.

Lập trình Web 66

Page 67: webform fundamental

Additional Application EventsAdditional Application EventsEvent-Handling Method DescriptionApplication_BeginRequest()

Occurs with each request the application receives, just before the page code is executed

Application_EndRequest()

Occurs with each request the application receives, just after the page code is executed.

Session_Start() Occurs whenever a new user request is received and a session is started.

Session_End() Occurs when a session times out or is programmatically ended

Application_Error() Occurs in response to an unhandled error

Lập trình Web 67

Page 68: webform fundamental

ASP.NET ConfigurationASP.NET ConfigurationThe web.config File.Nested Configuration.Storing Custom Settings in the web.config File.The Website Administration Tool (WAT)

Lập trình Web68

Page 69: webform fundamental

ASP.NET ConfigurationASP.NET Configuration

Every web application includes a web.config file that configures fundamental settings. (Everything from the way error messages are show to the security settings that lock out unwanted visitors).

The ASP.NET configuration files have several key advantages:They are never locked.

Lập trình Web 69

Page 70: webform fundamental

ASP.NET ConfigurationASP.NET ConfigurationThe ASP.NET configuration files have several key

advantages:They are never locked: You can update web.config settings

at any point, even while your application is running.

They are easily accessed and replicated: you can change a web.config file from a remote compute.

The settings are easy to edit and understand: The settings in the web.config file are humanreadable.

Lập trình Web 70

Page 71: webform fundamental

The web.config FileThe web.config FileThe web.config file uses a predefined XML format. The entire content of the file is nested in a root

<configuration> elementHere’s the basic skeletal structure of the web.config file

Lập trình Web 71

Page 72: webform fundamental

The web.config FileThe web.config FileThe <appSettings> section allows you to add your own

miscellaneous pieces of information.The <connectionStrings> section allows you to define the

connection information for accessing a database.The <system.web> section holds every ASP.NET setting

you’ll need to configure.Inside the <system.web> element are separate elements

for each aspect of website configuration.

Lập trình Web 72

Page 73: webform fundamental

Nested ConfigurationNested Configuration

ASP.NET uses a multilayered configuration system that allows you to set settings at different levels.

Every web server starts with some basic settings that are defined in two configuration files (machine.config and web.config ) in the c:\Windows\Microsoft.NET\Framework\v2.0.50727\Config directory.

Lập trình Web 73

Page 74: webform fundamental

Nested ConfigurationNested ConfigurationGenerally, you won’t edit either of these files manually,

because they affect the entire computer. Instead, you’ll configure the web.config file in your web

application folder. Using that file, you can set additional settings or override the defaults that are configured in the two system files.

The subdirectories in your virtual directory can contain their own web.config files with additional settings.

Subdirectories inherit web.config settings from the parent directory

Lập trình Web 74

Page 75: webform fundamental

Configuration inheritanceConfiguration inheritance

Lập trình Web 75

Page 76: webform fundamental

Storing Custom Settings in the Storing Custom Settings in the web.config Fileweb.config FileASP.NET also allows you to store your own settings in

the web.config file, in an element called <appSettings>.

Lập trình Web 76

Page 77: webform fundamental

Storing Custom Settings in the Storing Custom Settings in the web.config Fileweb.config FileYou can enter custom settings using an <add> element

that identifies a unique variable name (key) and the variable contents (value).

You can add as many application settings as you want.

Lập trình Web 77

Page 78: webform fundamental

Storing Custom Settings in the Storing Custom Settings in the web.config Fileweb.config FileYou retrieve custom application settings from web.config

by key name, using the WebConfigurationManager class.This class provides a static property called AppSettings

with a collection of application settings.

Lập trình Web 78

Page 79: webform fundamental

NotesNotesASP.NET is configured, by default, to deny any requests

for .config files.A remote user will not be able to access the file through

IIS. Instead, they’ll receive the error message.The web.config file is case-sensitive.

Lập trình Web 79

Page 80: webform fundamental

The Website Administration Tool The Website Administration Tool (WAT)(WAT)ASP.NET includes a graphical configuration tool called

the Website Administration Tool (WAT), which lets you configure various parts of the web.config file using a web page interface

To run the WAT to configure the current web project in Visual Studio, select Website => ASP.NET Configuration

Lập trình Web 80