Home | Contact Us | Download | Support | Purchase | Products

Product List
  "Of the 10 asp.net components I have bought and used over the years, yours have easily been the cleanest, and easiest to start using. Your components were up and running in production faster than any other components I have bought over the last 10 years. Thank you! "
Mike Otten

Using aspNetTraceRoute with Visual Studio .NET

When you are using aspNetTraceRoute in Visual Studio .NET it is recommended you IMPORT the aspNetDns.dll to the project. Once inside of the project, then set a reference to the IMPORTED copy, not the GAC installed copy. We recommend this method, because in the case aspNetDns is uninstalled from the server, your application will still run off of the imported aspNetDns.dll copy.

Please note that licensing requires a purchased license from aspNetDns for each copy installed on a different server or computer. The option of a site license is also available, where aspNetDns can be installed on an unlimited number of systems, at a single, physical location. Please visit www.aspNetTraceRoute.com for the latest licensing terms.


Using aspNetTraceRoute

aspNetTraceRoute is built on top of the System.Net.Sockets namespace.  To successfully build the ICMP packets, required by aspNetTraceRoute, raw sockets must be used. However, access to raw sockets can only be used by administrators. See the following kb article for more information.

PRB: RAW Socket Access Denied to Non-Admin Windows NT 4.0 and Windows 2000 Users


Using aspNetTraceRoute from an ASP.NET Page

This becomes an issue when you need to trace from an ASP.NET page.  From a default ASP.NET installation, you will need to make two changes to successfully trace from an ASP.NET page.  You will first need to allow the ASPNET account to act as part of the system. Once that is accomplished, you will be able to impersonate an administrator account to successfully trace.


Change 1

The first error encountered is typically--

An attempt was made to access a socket in a way forbidden by its access permissions
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.Sockets.SocketException: An attempt was made to access a socket in a way forbidden by its access permissions  message that says:


To fix this, you will need to

Open Control Panel | Administrative Tools | Local Security Policy, select  Local Policies and then User Rights Assignment from the tree "Act as part of OS" should be the second entry on the right hand paneontrol Panel. Add the ASPNET account to this list.


Change 2

The next change is a web.config entry that allows you to actually impersonate an administrator. To do this, open up the web.config in a text editor. Locate the <system.web> tag and add the following <identity> tag immedately afterwards.

<identity impersonate="true" userName="computername\AnAdministratorAccountHere" password="ThePasswordHere"/>


That's it!  That's all there is to allow aspNetTraceRoute to use the Raw sockets required to ping from an ASP.NET page.


More Information about Impersonation

MSDN: ASP.NET Impersonation

INFO: Implementing Impersonation in an ASP.NET Application

HOW TO: Use the ASP.NET Utility to Encrypt Credentials and Session State Connection Strings


Related Topics

Using aspNetTraceRoute in VS.NET [C#]

Using aspNetTraceRoute in VS.NET [VB.NET]

Using aspNetTraceRoute in a non-VS.NET Environment

The box is not shipped. aspNetTraceRoute is a downloadable product.