internal ApplicationSetting(IHttpSite httpSite) { var conf = httpSite.Config; MaxUploadFileLength = conf.GetInt64(MaxUploadFileLengthProperty, DefaultMaxUploadFileLength); MaxPostLength = conf.GetInt64(MaxPostLengthProperty, DefaultMaxPostLength); }
public ScriptEngines(IHttpSite httpSite, Config conf) { if (httpSite == null) { throw new ArgumentNullException(nameof(httpSite)); } if (conf == null) { throw new ArgumentNullException(nameof(conf)); } var baseDirectory = AppDomain.CurrentDomain.BaseDirectory; this.httpSite = httpSite; this.conf = conf; runtimeDirectory = Path.Combine(baseDirectory, "Runtime"); isDebug = conf.GetBoolean(IsDebugProperty, DefaultIsDebug); sessionDirectory = conf.GetString(SessionDirectoryProperty, DefaultSession); sessionDirectory = Path.Combine(baseDirectory, sessionDirectory); sessionTimeout = conf.GetTimeSpan(SessionTimeoutProperty, DefaultSessionTimeout); if (Directory.Exists(sessionDirectory)) { Directory.Delete(sessionDirectory, true); } if (!Directory.Exists(runtimeDirectory)) { Directory.CreateDirectory(runtimeDirectory); } Directory.CreateDirectory(sessionDirectory); var interval = conf.GetTimeSpan(SessionCheckIntervalProperty, DefaultSessionCheckInterval); timer = new Timer(new TimerCallback(CheckSession), null, TimeSpan.Zero, interval); }
public static FileInfo GetFileInfo(IHttpSite httpSite, string rawUrl) { var path = GetLocalPath(rawUrl); if (path.StartsWith(BackSlashString)) { path = path.TrimStart(BackSlashChar); } var dir = new DirectoryInfo(httpSite.BaseDirectory); var files = dir.GetFiles(path); if (files.Length > 1) { throw new ArgumentException(nameof(rawUrl)); } return(files.FirstOrDefault()); }
public override bool IsMath(IHttpSite httpSite, string rawUrl) { return(IsMatchExtension(rawUrl) && HttpUtility.GetFileInfo(httpSite, rawUrl) != null); }
public HttpContext(IHttpSite site, HttpListenerContext httpContext, string rawUrl) { this.site = site; this.httpContext = httpContext; this.rawUrl = rawUrl; }
public abstract bool IsMath(IHttpSite httpSite, string rawUrl);