1 / 8

Active Server Pages

Seoul Education & Science Research Institue. Active Server Pages. 정 영 식. nurunso@comedu.knue.ac.kr http://nurunso.pe.kr. 제 3 장 : Global.asa 와 Counter. Global.asa 의 Event. Counter 만들기. Global.asa. 파일 작성  웹 서버 시작 시 카운터 값 읽기  세션 시작 시 카운터 증가  주기적 카운터 저장  서버 동작이 끝날 때 카운터 저장.

angie
Download Presentation

Active Server Pages

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Seoul Education & Science Research Institue Active Server Pages 정 영 식 nurunso@comedu.knue.ac.kr http://nurunso.pe.kr

  2. 제3장 : Global.asa와 Counter • Global.asa의 Event • Counter 만들기

  3. Global.asa • 파일 작성  웹 서버 시작 시 카운터 값 읽기  세션 시작 시 카운터 증가  주기적 카운터 저장  서버 동작이 끝날 때 카운터 저장 <SCRIPT LANGUAGE="VBScript" RUNAT="Server"> Sub Application_OnStart ~ End Sub Sub Application_OnEnd ~ End sub Sub Session_OnStart ~ End Sub Sub Session_OnEnd ~ End Sub </SCRIPT> 1. Global.asa

  4. Application_OnStart SUB Application_OnStart VisitorCountFile = Server.MapPath ("/count") + ".txt" Set FileObject = Server.CreateObject("Scripting.FileSystemObject") Set Out= FileObject.OpenTextFile(VisitorCountFile, 1, FALSE, FALSE) Application("visitors") = Out.ReadLine Application("VisitorCountFile") = VisitorCountFile END SUB 2. Counter 만들기

  5. Session_OnStart1 • Counter 증가 SUB Session_OnStart Application.lock Application("visitors")= Application("visitors") + 1 t_visitors = application("visitors") Application.unlock 2. Counter 만들기

  6. Session_OnStart2 • 주기적 저장 If t_visitors MOD 5 = 0 Then SET FileObject = Server.CreateObject ("Scripting.FileSystemObject“) Set Out= FileObject.CreateTextFile (Application("VisitorCountFile"), TRUE, FALSE) Application.lock Out.WriteLine(t_visitors) Application.unlock End If END SUB 2. Counter 만들기

  7. Application_OnEnd SUB Application_OnEnd Set FileObject = Server.CreateObject("Scripting.FileSystemObject") Set Out= FileObject.CreateTextFile(Application ("VisitorCountFile"), TRUE, FALSE) Out.WriteLine(application("visitors")) END SUB 2. Counter 만들기

  8. Container File • 필요한 곳에 <% = Application(“visitors”) %> • Counter를 이쁘게 Count = Application(“visitors”) For i=1 to 7 ‘자리 수 Select case Mid(Count, i) Case “1” response.write(“<img src=‘images/1.jpg’>”) End Select Next 2. Counter 만들기

More Related