How to check session before access to static page?
Suliman via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Dec 3 04:32:13 PST 2015
void main()
{
auto router = new URLRouter;
router.get("/",
serveStaticFiles("D:\\code\\onlineTest\\index.html"));
router.get("/admin",
serveStaticFiles("D:\\code\\onlineTest\\admin.html"));
router.any("/foo", &foo);
auto settings = new HTTPServerSettings;
settings.port = 8080;
settings.bindAddresses = ["::", "127.0.0.1"];
settings.sessionStore = new MemorySessionStore; // SESSION
}
void foo(HTTPServerRequest req, HTTPServerResponse res)
{
if (req.session)
{
res.writeBody("Hello, World!", "text/plain");
}
}
Before showing foo I can check session status. But How to check
session status for static /admin page?
More information about the Digitalmars-d-learn
mailing list