I have a global request filter for authentication as suggested by mythz (ServiceStack dev), in this SO Answer
My filter:
RequestFilters.Add((httpReq, httpResp, requestDto) =>
{
if (!PublicRoutes.Contains(httpReq.PathInfo))
{
new AuthenticateAttribute().Execute(httpReq, httpResp, requestDto);
}
});
The filter does not fire for me when I request ServiceStack Razor pages that inherit dynamic ViewPage
Example /Default.cshtml:
@inherits ViewPage
<!DOCTYPE html>
<html>
<head>
<title>HOME</title>
...
...
ETC
Down the bottom of the answer, in the comments, the question raiser suggests similar behaviour, but does not accurately describe how to reproduce, so I cannot see a solution.
Is there a solution? Did I do something incorrect?
UPDATE
I've discovered I can declare attributes on my page directly:
@using ServiceStack.ServiceInterface
@inherits ViewPage
@{
new AuthenticateAttribute().Execute(Request, Response, this);
}
<!DOCTYPE html>
...
...
ETC
Or I'm sure I could create a class inherit ViewPage and run them in its Init method and use the new class on the Razor pages.
Both of those solutions seem extraneous and not very DRY, though.