Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
class function TIWExceptionRendererEx.RenderHTML
#2
I suppose that within your code you have access to your WebApplication instance, is that correct?

The property Data of the WebApplication contains a reference to your UserSession object:

UserSession := TIWUserSession(WebApplication.Data);

However, the typecast will require you to link the unit with this code to the UserSessionUnit where TIWUserSession is declared.

Another alternative is to use the UserSessionBase (the parent class of your UserSession) Clipboard object to temporarily store some values that are needed elsewhere. Something like:

uses
IWUserSessionBase;

UserSession := TIWUserSessionBase(WebApplication.Data);

// Store the value there
UserSession.Put("LoggedUser", "Mikael Nilsson");

// Store the value there
UserName := UserSession.Get("LoggedUser");

Note that in this example I don't need to link with the UserSessionUnit, only with the IWUserSessionBase unit which is part of the IW not your application. You can have a more generic approach using this.
Reply


Messages In This Thread
RE: class function TIWExceptionRendererEx.RenderHTML - by Alexandre Machado - 04-07-2023, 12:17 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)