Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
class function TIWExceptionRendererEx.RenderHTML
#6
You need to declare a variable of type TIWUserSession to assign the value to.

In the example above I used UserSession but probably the compiler is trying to use the UserSession function. Use a different name instead:

as I mentioned before, I'm assuming you have access to the WebApplication. If not, use gGetWebApplicationThreadVar() instead. The complete code should be:

Code:
uses
  UserSessionUnit, IWApplication;

procedure DoSomethingWithUserSession();
var
  WebApp: TIWApplication;
  theUserSession: TIWUserSession;
begin
  WebApp := gGetWebApplicationThreadVar();
  theUserSession  := nil;
  if Assigned(WebApp) then  // there is no guarantee that a TIWApplication instance exists when an exception is raised
    theUserSession := TIWUserSession(WebApp.Data);
  if Assigned(theUserSession) then
  begin
    // do what you have to do with the UserSession here
  end;
end;
Reply


Messages In This Thread
RE: class function TIWExceptionRendererEx.RenderHTML - by Alexandre Machado - 04-07-2023, 08:50 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)