using System.IO; using System.Net; using System.Text; namespace AllocsFixes.NetConnections.Servers.Web.Handlers { public class SessionHandler : PathHandler { private readonly string footer = ""; private readonly string header = ""; private readonly Web parent; private readonly string staticPart; public SessionHandler (string _staticPart, string _dataFolder, Web _parent, string _moduleName = null) : base (_moduleName) { staticPart = _staticPart; parent = _parent; if (File.Exists (_dataFolder + "/sessionheader.tmpl")) { header = File.ReadAllText (_dataFolder + "/sessionheader.tmpl"); } if (File.Exists (_dataFolder + "/sessionfooter.tmpl")) { footer = File.ReadAllText (_dataFolder + "/sessionfooter.tmpl"); } } public override void HandleRequest (HttpListenerRequest _req, HttpListenerResponse _resp, WebConnection _user, int _permissionLevel) { string subpath = _req.Url.AbsolutePath.Remove (0, staticPart.Length); StringBuilder result = new StringBuilder (); result.Append (header); if (subpath.StartsWith ("verify")) { if (_user != null) { _resp.Redirect ("/static/index.html"); return; } result.Append ( "