User rejected on browser closed - Open3270

Topics: Developer Forum, User Forum
Nov 11, 2014 at 7:57 PM

I have a web page that allows a user to log in and navigate IMS. However, if the user closes the browser without logging off from IMS I get the message below upon logging back in.


Is there a way to reset the session to resolve this issue?


Nov 12, 2014 at 6:33 PM
I suppose your users are connected to mainframe with specific LU. This problem should not appear if there is LU pool. You can disconnect user session easily if you are mainframe admin. Otherwise there is a small problem. You can set up mainframe to send NOP command to detect if session is still alive. Easier way is to setup script that will log off user automatically on browser close event.
Nov 12, 2014 at 6:48 PM

Thank you for the reply. Unfortunately, I don't have access or say to manipulate mainframe settings. However, I can control the close browser solution but I have a question:

What is the TNEmulator method call to use?

Similar solution I found, so is this the command?


My JavaScript calling on unload:

window.onbeforeunload = function(e) {
  $.ajax({ type: "POST", url: "terminal.aspx?logoff=1" });

I would then look for logoff querystring to issue the sign off command.


Nov 12, 2014 at 10:54 PM
There is only one method available TNEmulator.Close(). It closes telnet socket stream. Works fine for me, but I am using heavily modified version of this emulator. If this fails you can try to send logoff command directly too mainframe via emulator before closing stream. Logoff command depends on mainframe application. I am not sure also how you are using this library as web access. Generating pages dynamically via XML? I have developed winforms application for this, and as I know some ppl are using this library as part of active x plugin.
Nov 13, 2014 at 9:09 PM
Yes, we are using XML.

Unfortunately, sending a command (LOGOFF) before closing stream does not release the user. Are you using a different logoff command?
Nov 13, 2014 at 11:21 PM
Edited Nov 14, 2014 at 7:17 AM
As I said that depends on mainframe application. I am sorry but it is unclear to me what is behind your logoff procedure in aspx. When normally operating on the mainframe you send logoff command when you wanna close session with terminal?