What’s the suggested method for setting a content razor page to be protected? Should I manually extract the session and check if user.IsAuthenticated and trigger a redirect?
This statement “The behavior of accessing a protected page…” seems to imply that there is a way to flag a page.
http://stackoverflow.com/questions/13346070/redirect-on-successful-login-using-servicestack
I am not sure I necessarily want all my pages to move to a service driven approach yet. Using content pages with angular for now.
thanks!
You can just use the
RedirectIfNotAuthenticated() method on the ViewPage, e.g:
https://github.com/ServiceStack/HttpBenchmarks/blob/master/src/BenchmarksAnalyzer/Views/EditTestPlan.cshtml#L3
Otherwise if you want to control content on whether they’re authenticated or not you can use the IsAuthenticated
property, e.g:
https://github.com/ServiceStack/HttpBenchmarks/blob/master/src/BenchmarksAnalyzer/default.cshtml#L1
Sir Thomas:
Awesome, works like a charm!