<%@ Page language="c#" Codebehind="AutoLogin.aspx.cs" AutoEventWireup="false" Inherits="AutoLogin.WebForm1"%>
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.
View ASPX Page Source.
View Codebehind (.cs) Source.
To Use This Project On Your ASP .NET Machine Using Visual Studio 7.
-
Be sure to have a registered copy of DartTelnet.Dll (COM Dll) on the server.
-
Create a wrapper for the COM Dll by using the tlbimp app. The command should be
something like:
"C:\Program Files\Microsoft.NET\FrameworkSDK\Bin\TlbImp.exe" DartTelnet.dll
/out:DartTelnetDotnet.dll
-
Start a New Project in Visual Studio 7 named "Autologin". Choose C# ASP.NET Web
Application.
-
Copy the wrapper dll to the new Project in the Autologin/Bin directory.
-
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.
-
Rename WebForm1.aspx to Autologin.aspx.
-
Open Autologin.aspx in the editor and click the HTML tag to switch to HTML
view.
-
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.
-
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.
-
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.
-
Click Debug, Start Without Debugging to start the project.