File Web được cụ thể cho các ứng dụng web và một trong hai có thể được yêu cầu bởi một trình duyệt trực tiếp, hoặc được
sử dụng để xây dựng một phần của trang web được yêu cầu trong các trình duyệt. Bảng sau liệt kê các
c02.indd 41 2014/02/21 07:04:19
www.it-ebooks.info
42 | Chương 2 Xây dựng một trang web aSP.nET
file web khác nhau mà bạn thường sử dụng trong một ASP.NET Web Forms trang web và phần mở rộng của họ, và
mô tả cách mỗi tập tin được sử dụng.
nộp mô tả kiểu mở rộng
Web Form .aspx các Workhorse của bất kỳ ASP.NET Web Forms website; đại diện các trang mà người dùng của bạn xem trong trình duyệt của họ.
Master Page .master Cho phép bạn xác định cấu trúc toàn cầu và những cái nhìn
và cảm nhận của một trang web. Bạn thấy thế nào nó có thể được sử dụng trong
Chương 6.
Web User Control ascx Có mảnh trang đó có thể được tái sử dụng trong nhiều
trang trong trang web của bạn. Chương 8 là hoàn toàn dành cho người sử dụng
điều khiển.
HTML trang .html có thể được sử dụng để hiển thị HTML tĩnh trong trang web của bạn.
Style Sheet .css Có mã CSS cho phép bạn phong cách và định dạng
trang web của bạn. Bạn tìm hiểu thêm về CSS trong Chương 3.
Cấu hình Web
file
.config Chứa thông tin cấu hình toàn cầu được sử dụng
trong trang web. Bạn thấy làm thế nào để sử dụng web.config
sau trong cuốn sách này.
Sơ đồ trang web .sitemap Có một đại diện thứ bậc của tập tin trong trang web của bạn
trong một định dạng XML. Bản đồ trang web được sử dụng để điều hướng và
được thảo luận trong Chương 7.
Tệp JavaScript js Có JavaScript có thể được thực hiện trong các khách hàng của
trình duyệt.
Skin file .skin Chứa thông tin thiết kế cho điều khiển trong trang web của bạn.
Skins được thảo luận trong Chương 6.
Các tiếp theo Try It Out tập thể dục cho bạn thấy làm thế nào để thêm một trang chủ mới cho trang web, được sử dụng
trong suốt cuốn sách.
thử thêm tập tin vào trang web của bạn
1. Nếu nó không phải là vẫn còn mở, mở trang web Planet Wrox bạn đã tạo trước đó bằng cách chọn File ➪ mở
trang web. Hãy chắc chắn rằng bạn mở trang web từ các hệ thống tập tin, xác định vị trí thư mục chứa
trang web của bạn (C: BegASPNET Site), và nhấp vào nút Open.
2. Trong giải pháp Explorer, bấm chuột phải vào trang web của bạn và chọn Add ➪ New Folder.
Sai lầm thường gặp Hãy chắc chắn rằng bạn nhấp vào trang web thực tế và không phải là
tập tin Web.config hoặc nút Giải pháp ở đầu (xem hình 2-3) hoặc bạn đã giành 't
nhận được các mục trình đơn chính xác.
c02.indd 42 2014/02/21 07:04:19
www.it-ebooks.info
làm việc với các tập tin trong website của bạn | 43
3. Loại MasterPages như tên của thư mục và nhấn Đi vào. Sau đó kích chuột phải vào thư mục mới này
và chọn Thêm ➪ Add New Item. Ngoài ra, bạn có thể chọn File ➪ New File hoặc Website ➪
Add New Item từ menu chính của Visual Studio, hoặc bạn có thể nhấp vào thư mục mới trong Solution
Explorer một lần để đặt trọng tâm vào nó và sau đó nhấn Ctrl + Shift + A.
4. Trong hộp thoại xuất hiện, nhấp vào Master Page và gõ Frontend như tên. VS sẽ tự động thêm phần mở rộng .master cho bạn khi bạn thêm các tập tin. Thẩm định rằng trong Installed
Templates bạn đã chọn ngôn ngữ mà bạn muốn sử dụng cho trang web này và Nơi luật trong
tập tin riêng biệt ở góc dưới bên phải được kiểm tra. Cuối cùng, nhấn nút Add. Trang chủ
được thêm vào các trang web, và được mở tự động cho bạn trong cửa sổ tài liệu.
đang được dịch, vui lòng đợi..