You are not logged in.
Pages: 1
I'm trying to implement the Controller of MVC/MVVM Web application (MVCViewModel) as indicated on paragraph 19.2 of documentation but I have a problem.
The Default method is always accessible to the user.
In my case I'd like to force the use to login so I want check CurrentSession to check cookies status and show login page if the user has not logged in. In alternative, if the user is logged he will see the INDEX page of Web applications (this can be Default or other view).
My problem is: I cannot avoid to use Defualt method as main page of my application but I cannot understand how how can redirect the user on login page if CurrentSession test is to passed.
I have to use GotoView method? This method ask my a TMVCAction.
Offline
You can use code like this:
procedure TMyApp.Default(var Scope: Variant);
begin
if CurrentSession.CheckAndRetrieve(...) <> 0 then
begin
// OK, user logged in
end
else
// Redirect to Login page
raise EMVCApplication.CreateGotoView('Login', [], HTTP_TEMPORARYREDIRECT);
end;
Offline
Pages: 1