Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.8 KiB

  1. <% @ LANGUAGE = VBScript %>
  2. <% Option Explicit %>
  3. <% Response.Buffer=true %>
  4. <HTML>
  5. <HEAD>
  6. <TITLE>AspAppRestart Demo</TITLE>
  7. <%
  8. Dim objApp, objFile, strPath, vntAppRoot, intPos
  9. If Request.form("hFlag1") =1 Then
  10. Application("test")=Request.form("AppVar")
  11. End If
  12. If Request.form("hFlag2") =1 Then
  13. vntPath=Request.ServerVariables("PATH_INFO")
  14. Set objFile=GetObject("IIS://Localhost/W3svc/1/Root" & vPath)
  15. strAppRoot=oFile.AppRoot
  16. Set objFile=Nothing
  17. Set objApp= GetObject("IIS://Localhost/" & mid(strAppRoot,5))
  18. 'call aspAppRestart and refresh asp.
  19. 'all application variables are gone
  20. objApp.aspAppRestart
  21. Response.Clear
  22. Response.Redirect("aspAppRestart.asp")
  23. End If
  24. %>
  25. </HEAD>
  26. <BODY >
  27. <FONT SIZE="4" FACE="ARIAL, HELVETICA">
  28. <B> AspAppRestart Demo</B></FONT><BR>
  29. <HR SIZE="1" COLOR="#000000">
  30. For this sample to work properly, you need to do following<BR>
  31. 1) Your NT account needs to have IIS admin permission <BR>
  32. 2) start MMC version internet service manager<BR>
  33. 3) locate aspAppRestart.asp file from the manager<BR>
  34. 4) clear anonymous authentication for this file (if It is cleared, set it on and the off.
  35. The last step will also add the file info to metabase, which is needed in this asp file)<BR>
  36. <P>
  37. <HR SIZE="1" COLOR="#000000">
  38. Application("test") = <% =Application("test") %>
  39. <HR SIZE="1" COLOR="#000000">
  40. <FORM action="AspAppRestart.asp" method="post">
  41. <P>Set Application("test") Variable
  42. <BR><INPUT id=text1 name="AppVar" >
  43. <BR><INPUT type="submit" value="Submit" id=submit1 name=submit1>
  44. <INPUT type=hidden name ="hFlag1" value=1>
  45. </FORM></P>
  46. <FORM action="AspAppRestart.asp" method="post">
  47. <P>Click to restart Application
  48. <BR><INPUT type="submit" value="Restart App">
  49. <INPUT type=hidden name=hFlag2 value=1 >
  50. </FORM>
  51. </BODY>
  52. </HTML>