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


Product List
 
  "Once again thank you for your rapid help and support! This will defiantly save us a lot of time and effort. "
Adnan
Home Quarters
 
More
Testimonies

 

Using aspNetPing with Visual Studio .NET

When you are using aspNetPing 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.aspNetPing.com for the latest licensing terms.

 

Using aspNetPing

aspNetPing is built on top of the System.Net.Sockets namespace.  To successfully build the ICMP packets, required by aspNetPing, 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 aspNetPing from an ASP.NET Page

This becomes an issue when you need to ping from an ASP.NET page.  From a default ASP.NET installation, you will need to make two changes to successfully ping 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 ping.

 

Change 1

The first error encountered is typically a

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 aspNetPing to use the Raw sockets required to ping from an ASP.NET page.

More Information about Impersonation

MSDN: ASP.NET Impersonation
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconaspnetimpersonation.asp

INFO: Implementing Impersonation in an ASP.NET Application
http://support.microsoft.com/default.aspx?scid=kb;en-us;306158


HOW TO: Use the ASP.NET Utility to Encrypt Credentials and Session State Connection Strings
http://support.microsoft.com/default.aspx?scid=kb;en-us;329290#3

 

Related Topics

Using aspNetPing in VS.NET [C#]

Using aspNetPing in VS.NET [VB.NET]

Using aspNetPing in a non-VS.NET Environment



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