Phòng chống DDOS hiệu quả
-
Tấn công DDOS hay còn được gọi tấn công từ chối dịch vụ đơn giản được hiểu
là tạo ra 1 lượt truy cập ảo ồ ạt vào một địa chỉ website tại cùng một thời
đi...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
| <!--<%@ Application Language="C#" %><script runat="server"> void Application_Start(object sender, EventArgs e) { // Code that runs on application startup } void Application_End(object sender, EventArgs e) { // Code that runs on application shutdown } void Application_Error(object sender, EventArgs e) { // Code that runs when an unhandled error occurs } void Session_Start(object sender, EventArgs e) { // Code that runs when a new session is started } void Session_End(object sender, EventArgs e) { // Code that runs when a session ends. // Note: The Session_End event is raised only when the sessionstate mode // is set to InProc in the Web.config file. If session mode is set to StateServer // or SQLServer, the event is not raised. }</script>--> |
1
2
3
4
5
6
7
| void Application_Start(object sender, EventArgs e) { // Khai báo đếm số người truy cập Application["So_luot_truy_cap"] = 0 Application["So_nguoi_online"] = 0} |
1
2
3
4
5
6
7
8
| <!-- void Session_Start(object sender, EventArgs e) { // Tăng giá trị biến Application Application["So_luot_truy_cap"] = (int)Application["So_luot_truy_cap"] + 1; Application["So_nguoi_online"] = (int)Application["So_nguoi_online"] + 1; }--> |
1
2
3
4
5
6
7
| <!-- void Session_End(object sender, EventArgs e) { // Giảm giá trị biến Application Application["So_nguoi_online"] = (int)Application["So_nguoi_online"] - 1; }--> |
1
2
3
4
5
6
7
8
9
10
11
12
| <!--<?xml version="1.0"?> <configuration> <configSections> ........... </configSections> <system.web> .......... </system.web> </configuration>--> |
1
2
3
| <!-- <compilation debug="true"/> --> |
1
2
3
| <!--<customErrors mode="RemoteOnly"/>--> |
1
2
3
| <!--<customErrors mode="RemoteOnly" defaultRedirect="ThongBaoLoi.aspx"/>--> |
1
2
3
4
5
6
7
8
9
| <!--<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1; Trusted_Connection=yes" cookieless="false" timeout="20" />--> |
OK, vậy là xong bài này chúng ta có thể xây dựng tính năng hiển thị số
người truy cập và số người online trong web asp.net ngoài ra còn biết
cách cấu hình cơ bản trong file web.config! Chúc thành công!
Bạn đang xem Tập tin Global.asax trong ASP.Net tại Tin Tức Thủ Thuật PC Đừng quên nhấn LIKE và Chia Sẻ nếu bài viết có ích !
Comments[ 0 ]
Đăng nhận xét