Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

88 рядки
2.5KB

  1. <%@ Language="VBScript" %>
  2. <% Option Explicit %>
  3. <%
  4. ' This test app owns its bootstrap and explicitly selects only the test route
  5. ' set in the shared framework. Production's bootstrap selects "production".
  6. ' Keeping this value inside each app prevents direct Default.asp?route=...
  7. ' requests from crossing the application boundary.
  8. Dim route, httpMethod, logDir, viewsDir, ctx, app, applicationName, statusLine, contentType, body, allowHeader
  9. route = Request.QueryString("route")
  10. httpMethod = Request.ServerVariables("REQUEST_METHOD")
  11. applicationName = "tests"
  12. ' logs/ and Views/ deliberately live outside the served "public" webroot (IIS
  13. ' site physical path = public/), so parent-relative MapPath is required here -
  14. ' requires enableParentPaths=true for this site. See docs/DECISIONS.md.
  15. logDir = Server.MapPath("../logs")
  16. viewsDir = Server.MapPath("../Views")
  17. Set ctx = Nothing
  18. On Error Resume Next
  19. Set ctx = Server.CreateObject("WscMvc.RequestContext")
  20. If Err.Number <> 0 Then
  21. Err.Clear
  22. On Error Goto 0
  23. Response.Status = "500 Internal Server Error"
  24. Response.ContentType = "text/plain; charset=utf-8"
  25. Response.Write "Internal Server Error"
  26. Response.End
  27. End If
  28. On Error Goto 0
  29. On Error Resume Next
  30. ctx.Initialize route, httpMethod, logDir
  31. If Err.Number <> 0 Then
  32. Err.Clear
  33. On Error Goto 0
  34. Set ctx = Nothing
  35. Response.Status = "500 Internal Server Error"
  36. Response.ContentType = "text/plain; charset=utf-8"
  37. Response.Write "Internal Server Error"
  38. Response.End
  39. End If
  40. On Error Goto 0
  41. Set app = Nothing
  42. On Error Resume Next
  43. Set app = Server.CreateObject("WscMvc.Application")
  44. If Err.Number <> 0 Then
  45. Err.Clear
  46. On Error Goto 0
  47. Set ctx = Nothing
  48. Response.Status = "500 Internal Server Error"
  49. Response.ContentType = "text/plain; charset=utf-8"
  50. Response.Write "Internal Server Error"
  51. Response.End
  52. End If
  53. On Error Goto 0
  54. statusLine = ""
  55. contentType = ""
  56. body = ""
  57. allowHeader = ""
  58. On Error Resume Next
  59. app.Run ctx, applicationName, viewsDir, statusLine, contentType, body, allowHeader
  60. If Err.Number <> 0 Then
  61. Err.Clear
  62. On Error Goto 0
  63. Set app = Nothing
  64. Set ctx = Nothing
  65. Response.Status = "500 Internal Server Error"
  66. Response.ContentType = "text/plain; charset=utf-8"
  67. Response.Write "Internal Server Error"
  68. Response.End
  69. End If
  70. On Error Goto 0
  71. Response.Status = statusLine
  72. Response.ContentType = contentType
  73. If Len(allowHeader) > 0 Then
  74. Response.AddHeader "Allow", allowHeader
  75. End If
  76. Response.Write body
  77. Set app = Nothing
  78. Set ctx = Nothing
  79. %>

Powered by TurnKey Linux.