tailieunhanh - mcts 70-562 Microsoft .NET Framework 3.5, ASP.NET Application Development phần 8

Đây là kết quả của dịch vụ Web làm việc giống như một trang Web. Cả hai đều có một URL trỏ đến một tập tin. Do đó, bạn có thể khóa tập tin này giống như bạn sẽ bất kỳ tài nguyên . Mỗi tùy chọn bảo mật đến Sau đây đại diện cho nội dung của file được tìm thấy bên trong thư mục Quản lý sau khi hoạt động này: | C public void ProcessRequest HttpContext context image jpeg @ C Users Public Pictures Sample Pictures NOTE DEFINING THE MIME TYPE Note that this code sample sets the property to image jpeg. You should use this property to define the correct Multipurpose Internet Mail Extensions MIME type so that the browser knows how to handle the file you send it. Otherwise the browser might try to display it as text. 7. Open the file. Navigate to the httpHandlers node. Add a handler that maps the .jpg file extension to your ImageHandler class. The following markup demonstrates this configuration httpHandlers add verb path .jpg type ImageHandler httpHandlers configuration 8. Open in the designer. Drag an Image control to the page. Change the ImageUrl property to . This file does not exist so a placeholder is displayed in the designer. However this is a request for a jpg file. Your HttpHandler will intercept this request and display the image as defined in the ProcessRequest code it will display . 9. Run your application using the local Web application server and not IIS . The local Web server will simulate the custom handler. You can verify the results in a browser window. Lesson Summary You can catch unhandled exceptions at the page level by responding to Page_Error or at the application level by responding to Application_Error. In either event handler you read the last error by calling . Then you must remove it from the queue by calling . Lesson 1 Using Web Site Programmability CHAPTER 11 727 You can call to return a configuration section from the file. You cast the returned object to the section-specific type. If you make an update to the configuration settings write the changes by calling or . .

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.