Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

99 lignes
3.0KB

  1. <%@ Language="VBScript" %>
  2. <% Option Explicit %>
  3. <%
  4. Dim route, httpMethod, logDir, viewsDir, dbConnStringPath, dbConnStringFso, dbConnectionString, ctx, app, applicationName, statusLine, contentType, body, allowHeader
  5. route = Request.QueryString("route")
  6. httpMethod = Request.ServerVariables("REQUEST_METHOD")
  7. applicationName = "production"
  8. ' logs/ and Views/ deliberately live outside the served "public" webroot (IIS
  9. ' site physical path = public/), so parent-relative MapPath is required here -
  10. ' requires enableParentPaths=true for this site. See docs/DECISIONS.md.
  11. logDir = Server.MapPath("../logs")
  12. viewsDir = Server.MapPath("../Views")
  13. ' db.connectionstring holds the live DB credentials and is never committed
  14. ' (see .gitignore, docs/DECISIONS.md) - read as plain framework wiring here,
  15. ' same as logDir/viewsDir, never hardcoded into any tracked file. Optional:
  16. ' an empty string means no route on this app currently needs a database.
  17. dbConnStringPath = Server.MapPath("../db.connectionstring")
  18. dbConnectionString = ""
  19. On Error Resume Next
  20. Set dbConnStringFso = Server.CreateObject("Scripting.FileSystemObject")
  21. If dbConnStringFso.FileExists(dbConnStringPath) Then
  22. dbConnectionString = Trim(dbConnStringFso.OpenTextFile(dbConnStringPath, 1).ReadAll)
  23. End If
  24. Set dbConnStringFso = Nothing
  25. Err.Clear
  26. On Error Goto 0
  27. Set ctx = Nothing
  28. On Error Resume Next
  29. Set ctx = Server.CreateObject("WscMvc.RequestContext")
  30. If Err.Number <> 0 Then
  31. Err.Clear
  32. On Error Goto 0
  33. Response.Status = "500 Internal Server Error"
  34. Response.ContentType = "text/plain; charset=utf-8"
  35. Response.Write "Internal Server Error"
  36. Response.End
  37. End If
  38. On Error Goto 0
  39. On Error Resume Next
  40. ctx.Initialize route, httpMethod, logDir
  41. If Err.Number <> 0 Then
  42. Err.Clear
  43. On Error Goto 0
  44. Set ctx = Nothing
  45. Response.Status = "500 Internal Server Error"
  46. Response.ContentType = "text/plain; charset=utf-8"
  47. Response.Write "Internal Server Error"
  48. Response.End
  49. End If
  50. On Error Goto 0
  51. Set app = Nothing
  52. On Error Resume Next
  53. Set app = Server.CreateObject("WscMvc.Application")
  54. If Err.Number <> 0 Then
  55. Err.Clear
  56. On Error Goto 0
  57. Set ctx = Nothing
  58. Response.Status = "500 Internal Server Error"
  59. Response.ContentType = "text/plain; charset=utf-8"
  60. Response.Write "Internal Server Error"
  61. Response.End
  62. End If
  63. On Error Goto 0
  64. statusLine = ""
  65. contentType = ""
  66. body = ""
  67. allowHeader = ""
  68. On Error Resume Next
  69. app.Run ctx, applicationName, viewsDir, dbConnectionString, statusLine, contentType, body, allowHeader
  70. If Err.Number <> 0 Then
  71. Err.Clear
  72. On Error Goto 0
  73. Set app = Nothing
  74. Set ctx = Nothing
  75. Response.Status = "500 Internal Server Error"
  76. Response.ContentType = "text/plain; charset=utf-8"
  77. Response.Write "Internal Server Error"
  78. Response.End
  79. End If
  80. On Error Goto 0
  81. Response.Status = statusLine
  82. Response.ContentType = contentType
  83. If Len(allowHeader) > 0 Then
  84. Response.AddHeader "Allow", allowHeader
  85. End If
  86. Response.Write body
  87. Set app = Nothing
  88. Set ctx = Nothing
  89. %>

Powered by TurnKey Linux.