<%@ Language="VBScript" %> <% Option Explicit %> <% ' This test app owns its bootstrap and explicitly selects only the test route ' set in the shared framework. Production's bootstrap selects "production". ' Keeping this value inside each app prevents direct Default.asp?route=... ' requests from crossing the application boundary. Dim route, httpMethod, logDir, viewsDir, dbConnStringPath, dbConnStringFso, dbConnectionString, ctx, app, applicationName, statusLine, contentType, body, allowHeader route = Request.QueryString("route") httpMethod = Request.ServerVariables("REQUEST_METHOD") applicationName = "tests" ' logs/ and Views/ deliberately live outside the served "public" webroot (IIS ' site physical path = public/), so parent-relative MapPath is required here - ' requires enableParentPaths=true for this site. See docs/DECISIONS.md. logDir = Server.MapPath("../logs") viewsDir = Server.MapPath("../Views") ' db.connectionstring holds the live DB credentials and is never committed ' (see .gitignore, docs/DECISIONS.md) - read as plain framework wiring here, ' same as logDir/viewsDir, never hardcoded into any tracked file. Optional: ' an empty string means it isn't provisioned on this deployment. Unlike ' logs/ (each site has its own), there is exactly one shared credential file ' at the project root - test-app/public/ is two levels below the project ' root (root -> test-app -> public), one level deeper than production's ' public/ (root -> public), so it needs "../../" not "../" to reach it. dbConnStringPath = Server.MapPath("../../db.connectionstring") dbConnectionString = "" On Error Resume Next Set dbConnStringFso = Server.CreateObject("Scripting.FileSystemObject") If dbConnStringFso.FileExists(dbConnStringPath) Then dbConnectionString = Trim(dbConnStringFso.OpenTextFile(dbConnStringPath, 1).ReadAll) End If Set dbConnStringFso = Nothing Err.Clear On Error Goto 0 Set ctx = Nothing On Error Resume Next Set ctx = Server.CreateObject("WscMvc.RequestContext") If Err.Number <> 0 Then Err.Clear On Error Goto 0 Response.Status = "500 Internal Server Error" Response.ContentType = "text/plain; charset=utf-8" Response.Write "Internal Server Error" Response.End End If On Error Goto 0 On Error Resume Next ctx.Initialize route, httpMethod, logDir If Err.Number <> 0 Then Err.Clear On Error Goto 0 Set ctx = Nothing Response.Status = "500 Internal Server Error" Response.ContentType = "text/plain; charset=utf-8" Response.Write "Internal Server Error" Response.End End If On Error Goto 0 Set app = Nothing On Error Resume Next Set app = Server.CreateObject("WscMvc.Application") If Err.Number <> 0 Then Err.Clear On Error Goto 0 Set ctx = Nothing Response.Status = "500 Internal Server Error" Response.ContentType = "text/plain; charset=utf-8" Response.Write "Internal Server Error" Response.End End If On Error Goto 0 statusLine = "" contentType = "" body = "" allowHeader = "" On Error Resume Next app.Run ctx, applicationName, viewsDir, dbConnectionString, statusLine, contentType, body, allowHeader If Err.Number <> 0 Then Err.Clear On Error Goto 0 Set app = Nothing Set ctx = Nothing Response.Status = "500 Internal Server Error" Response.ContentType = "text/plain; charset=utf-8" Response.Write "Internal Server Error" Response.End End If On Error Goto 0 Response.Status = statusLine Response.ContentType = contentType If Len(allowHeader) > 0 Then Response.AddHeader "Allow", allowHeader End If Response.Write body Set app = Nothing Set ctx = Nothing %>