Experience the surprise of the new. net Ajax refreshing Technology

Source: Internet
Author: User

Today, I got a. net Ajax development kit, which includes ASP2.0 and Ajax currently used in ASP1.1. For more information, see http://ajax.schwarz-interactive.de.

1. Create a new project and add reference Ajax. dll to the reference. Ajax. dll is located in the downloaded package.

2. Create HttpHandler and add it to web. config.


<Configuration>

<System. web>

<HttpHandlers>

<Add verb = "POST, GET" path = "ajax/*. ashx" type = "Ajax. PageHandlerFactory, Ajax"/>

</HttpHandlers>

<System. web>

</Configuration>

3. Create a new class DemoMethods, which can obtain the client MAC address:




Using System;

Using System. Web;

Namespace AjaxSample

{

/** // <Summary>

/// Summary description for Methods.

/// </Summary>

Public class DemoMethods

{

[Ajax. AjaxMethod]

Public string GetCustomerMac (string clientIP) // enter the Client IP address here. This function is used for testing. You can also write other simple functions instead.

{

String mac = "";

System. Diagnostics. Process process = new System. Diagnostics. Process ();

Process. StartInfo. FileName = "nbtstat ";

Process. StartInfo. Arguments = "-a" + clientIP;

Process. StartInfo. UseShellExecute = false;

Process. StartInfo. CreateNoWindow = true;

Process. StartInfo. RedirectStandardOutput = true;

Process. Start ();

String output = process. StandardOutput. ReadToEnd ();

Int length = output. IndexOf ("MAC Address = ");

If (length> 0)

{

Mac = output. Substring (length + 14, 17 );

}

Process. WaitForExit ();

Return mac. Replace ("-", ""). Trim ();

}

}

}



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.