<%@ Page language="c#" Codebehind="AutoLogin.aspx.cs" AutoEventWireup="false" Inherits="AutoLogin.WebForm1"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <meta name="GENERATOR" Content="Microsoft Visual Studio 7.0"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name="vs_defaultClientScript" content="JavaScript (ECMAScript)"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body> <font size="2" face="arial">This sample demonstrates the use of the PowerTCP Telnet component in the .NET environment. After you hit login, a Telnet control will attempt to connect to port 23 on the desired server. If this was sucessful, the incoming stream is searched until the last characters match those of the login prompt. Next the username is sent and the password prompt is searched for. This process is continued until we arrive at the command prompt.</font> <form id="Form1" method="post" runat="server"> <table style="WIDTH: 298px; HEIGHT: 206px"> <tr> <td> <asp:Label id="lblServer" runat="server" Font-Bold="True" Font-Names="Arial" Font-Size="X-Small">Server Address:</asp:Label> </td> <td> <asp:TextBox id="txtServer" runat="server"></asp:TextBox> </td> </tr> <tr> <td> <asp:Label id="lblLoginPrompt" runat="server" Font-Bold="True" Font-Names="Arial" Font-Size="X-Small">Login Prompt:</asp:Label> </td> <td> <asp:TextBox id="txtLoginPrompt" runat="server"></asp:TextBox> </td> </tr> <tr> <td> <asp:Label id="lblUsername" runat="server" Font-Bold="True" Font-Names="Arial" Font-Size="X-Small">Username:</asp:Label> </td> <td> <asp:TextBox id="txtUsername" runat="server"></asp:TextBox> </td> </tr> <tr> <td> <asp:Label id="lblPassPrompt" runat="server" Font-Bold="True" Font-Names="Arial" Font-Size="X-Small">Password Prompt:</asp:Label> </td> <td> <asp:TextBox id="txtPassPrompt" runat="server"></asp:TextBox> </td> </tr> <tr> <td> <asp:Label id="lblPass" runat="server" Font-Bold="True" Font-Names="Arial" Font-Size="X-Small">Password:</asp:Label> </td> <td> <asp:TextBox id="txtPass" runat="server" TextMode="Password"></asp:TextBox> </td> </tr> <tr> <td> <asp:Label id="lblCommand" runat="server" Font-Bold="True" Font-Names="Arial" Font-Size="X-Small">Command Prompt:</asp:Label> </td> <td> <asp:TextBox id="txtCommand" runat="server"></asp:TextBox> </td> </tr> </table> <br> <asp:Button id="Button1" runat="server" Text="Login"></asp:Button> <br> <asp:Label id="lblResults" runat="server" Font-Names="Arial" Font-Size="X-Small"></asp:Label> <br> </form> <font face="arial" size="2">View <a href="autologinaspx.inc">ASPX Page Source</a>. <br> View <a href="autologincs.inc">Codebehind (.cs) Source</a>. <br> <br> <h5> To Use This Project On Your ASP .NET Machine Using Visual Studio 7. </h5> <ul> <li> Be sure to have a registered copy of DartTelnet.Dll (COM Dll) on the server. <li> Create a wrapper for the COM Dll by using the tlbimp app. The command should be something like: <br> <code>"C:\Program Files\Microsoft.NET\FrameworkSDK\Bin\TlbImp.exe" DartTelnet.dll /out:DartTelnetDotnet.dll </code> <br> <li> Start a New Project in Visual Studio 7 named "Autologin". Choose C# ASP.NET Web Application. <li> Copy the wrapper dll to the new Project in the Autologin/Bin directory. <li> In the Solution Explorer, right click References and choose Add Reference. Select the .NET tab and browse to find your wrapper dll. Add it as a reference. <li> Rename WebForm1.aspx to Autologin.aspx. <li> Open Autologin.aspx in the editor and click the HTML tag to switch to HTML view. <li> Click the "View ASPX Source" link above. Copy the text from the resulting page and paste this text entirely over the text on Autologin.aspx in the editor. <li> Remove the "xmp" html tags from the beginning and end of Autologin.aspx. These were used so the HTML wouldn't be parsed by the browser. <li> Click the Design Tab to switch to design view. Double click the button to open the .cs class for editing. Click the "View Codebehind (.cs) Source" link above. Copy the text from the resulting page and paste this text entirely over the text on Autologin.aspx.cs in the editor. <li> Click Debug, Start Without Debugging to start the project.</li> </ul> </font> </body> </HTML>