The following steps will demonstrate how to use aspNetDns in a non-Visual Studio .NET environment. For this ASP.NET application to work successfully you will need FTP access or file share access to your website.
1. FTP (or through file sharing) connect to your web application.
2. Locate the /Bin directory. If there isn’t a directory named Bin you will need to create it under the root directory.
3. Upload the aspNetDns.dll to the /Bin directory. By default, the aspNetDns.dll can be found in c:\Program Files\advancedintellect\aspNetDns.
Once the aspNetDns has been uploaded, you
will be able to create a test ASP.NET page. The following steps will demonstrate
this, using both C# and VB.NET.
1. To create a sample page, called TestDns.aspx, start Notepad.
2. If you are using C# as your development language, enter the following code. If you are using VB.NET, that code can be found in the next step.
[C#]
<%@ Page language="c#" %>
<%@ Import Namespace="aspNetDns.Records"%>
<html>
<head>
<title>TestDns</title>
</head>
<body MS_POSITIONING="GridLayout">
<form id="TestDns" method="post" runat="server">
Please enter an IP Address to lookup:
<br>
<input type=text id=txtIPAddress runat=server NAME="txtIPAddress"><input type=submit value="submit">
<asp:Literal ID=litMsg Runat=server></asp:Literal>
</form>
</body>
</html>
<script runat=server>
private void Page_Load(object sender, System.EventArgs e)
{
if( Page.IsPostBack)
{
if( txtIPAddress.Value.Length > 0 )
{
PointerRecord[] records = PointerRecord.GetPointerRecords( txtIPAddress.Value );
if( records.Length > 0 )
{
litMsg.Text = string.Empty;
for( int i=0;i<records.Length;i++)
{
litMsg.Text += "<BR>" + txtIPAddress.Value + " maps to " + records[i].PointerName;
}
}
else
{
litMsg.Text = "No Records Were Found.";
}
}
else
{
litMsg.Text = "Please Enter a Valid IP Address";
}
}
else //populate with the client IP Address
{
txtIPAddress.Value = Request.UserHostAddress;
}
}
</script>
[VB.NET]
<%@ Page language="VB" %>
<%@ Import Namespace="aspNetDns.Records"%>
<html>
<head>
<title>TestDns</title>
</head>
<body MS_POSITIONING="GridLayout">
<form id="TestDns" method="post" runat="server">
Please enter an IP Address to lookup:
<br>
<input type=text id=txtIPAddress runat=server NAME="txtIPAddress"><input type=submit value="submit">
<asp:Literal ID=litMsg Runat=server></asp:Literal>
</form>
</body>
</html>
<script runat=server>
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Page.IsPostBack Then
If txtIPAddress.Value.Length > 0 Then
Dim records As PointerRecord() = PointerRecord.GetPointerRecords(txtIPAddress.Value)
If records.Length > 0 Then
litMsg.Text = String.Empty
Dim i As Integer
For i = 0 To records.Length - 1
litMsg.Text += "<BR>" + txtIPAddress.Value + " maps to " + records(i).PointerName
Next i
Else
litMsg.Text = "No Records Were Found."
End If
Else
litMsg.Text = "Please Enter a Valid IP Address"
End If
'populate with the client IP Address
Else
txtIPAddress.Value = Request.UserHostAddress
End If
End Sub
</script>
4. Save this file as TestDns.aspx and upload it to your web
application.
5. Open Internet Explorer (or a suitable web browser) and navigate it to your website and view the TestDns.aspx (for example http://localhost/TestDns.aspx ).
6. By default, your client IP address will be entered in the text box. Click Submit, and aspNetDns will Reverse Lookup your IP address.
That's all there is to using aspNetDns from a Non - Visual Studio .NET environment. In these few simple steps you were able to create an email and send it from an ASP.NET page.