TAILIEUCHUNG - Lấy toàn bộ url trong một webpage với ASP

Chúng ta sẽ xây dựng một class đơn giản để lấy toàn bộ urls trong một web pageClass này có một public method: RetrieveUrls, method này lại gọi 2 private mothods khác: RetrieveContents và GetAllUrls RetrieveContents sẽ phát đi một request tới web page, và nhận lại nội dung của page. | Lấy toàn bộ url trong một webpage với ASP Chúng ta sẽ xây dựng một class đơn giản để lấy toàn bộ urls trong một web page Class này có một public method RetrieveUrls method này lại gọi 2 private mothods khác RetrieveContents và GetAllUrls RetrieveContents sẽ phát đi một request tới web page và nhận lại nội dung của page. GetAllUrls method sẽ dùng một expression đơn giản để tìm tất cả urls trong page sau đó in toàn bộ ra screen đồng thời cũng lưu vào file log. Dưới đây là toàn bộ code của class using System using using using using using namespace FindAllUrls class GetUrls public method called from your application public void RetrieveUrls string webPage GetAllUrls RetrieveContent webPage get the content of the web page passed in private string RetrieveContent string webPage HttpWebResponse response null used to get response StreamReader respStream null used to read response into string try create a request object using the url passed in HttpWebRequest request HttpWebRequest webPage 10000 go get a response from the page response HttpWebResponse create a streamreader object from the response respStream new StreamReader get the contents of the page as a string and return it return catch Exception ex houston we have a problem throw ex finally close it down we re going home

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.