download a. NET AJAX Development Kit, which includes Ajax for ASP2.0 and the current ASP1.1 edition, detailed address see http://ajax.schwarz-interactive.de/, Next, start.
1. Create a new item, add a reference to the reference Ajax.dll,ajax.dll is located in the downloaded compressed package.
2. Establish HttpHandler, add in web.config
3. Create a new class Demomethods, this class implementation gets the client MAC address:
System.Diagnostics.Process Process = new System.Diagnostics.Process ();
Process. Start ();
string output = process. Standardoutput.readtoend ();
Process. WaitForExit ();
Return Mac. Replace ("-", ""). Trim ();
function Getmac ()
5. Put an HTML button on an ASPX page
Refer to Default.js on the page
Add in the onclick event of input
<input style= "Z-INDEX:101; left:392px; Position:absolute; top:176px "type=" button "
value= "Client Get IP" >
6. Add the Page_Load event to the page page
private void Page_Load (object sender, System.EventArgs e)
Note: in typeof (Ajaxsample.demomethods), Ajaxsample is a namespace, Demomethods is the class that contains the method to invoke, that is, step 3rd above. New Class Demomethods
7. Modify the Global.asax Application_Start event and set the Ajax Handlerpath:
protected void Application_Start (Object sender, EventArgs e)
Run to see the effect. is the MAC address of the client that is not refreshed on the server side?
It should be noted that this version of. NET AJAX requires manual global.asax plus Ajax.Utility.HandlerPath = "Ajax"; Configuration file web.config must add HttpHandler configuration information!
The new version of the development package has not had time to experience, it is estimated that the new version will be more convenient, may remove the manual settings Global.asax Application_Start event plus Ajax.Utility.HandlerPath = "Ajax"; and other troublesome settings!