<%@ Language="VBScript" %> <% Option Explicit %> <% 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 = "production" ' 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 no route on this app currently needs a database. 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 %>