RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomPageDispatcher.OnCanViewPage Event

Occurs just before the dispatcher passes a request message to a Web page module.

Pascal
property OnCanViewPage: TCanViewPageEvent;
C++
__property TCanViewPageEvent OnCanViewPage;

Write an OnCanViewPage event handler to customize the way the WebSnap application determines whether a given request can be passed to a Web page module for processing. This event is part of the mechanism by which the dispatcher validates a Web page for viewing. The validation process, which occurs after the OnBeforeDispatchPage event, occurs as follows: 

 

  1. If the caller has not already logged in, the dispatcher generates an OnIsLoginRequired event to check whether the specified Web page requires the caller to log in. 

  2. If a login is required, the dispatcher does not validate the page (and so does not forward the request to the specified Web page module). Rather, it initiates the process of creating a response to allow the user to log in. 

a. First, the dispatcher generates an OnPageAccessDenied event, where the application can handle the login process.  

b. If the OnPageAccessDenied event handler does not handle the login process, the dispatcher forwards the request to the login page specified by the end user adapter's LoginPage property. 

 

  1. If a login is not required (either because the caller already logged in or because there is no need to log in), the dispatcher generates an OnCanViewPage event. This event can validate a caller that has logged in, or provide any other type of validation that governs access to the requested page. 

  2. If there is no OnCanViewPage event handler, or if the OnCanViewPage event handler does not handle the validation, the dispatcher calls on a TEndUserAdapter component to check the user's access rights.
    Tip: To access the Web request and response objects from within an OnCanViewPage event handler, call the global WebContext function to access the Web context and read its Request and Response properties. To access information about the access rights that the target page requires, call the Web context's FindPageInfo method to obtain a Web page info object for the target page and check its ViewAccess property.

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!