. NET Ajax refresh technology without the initial experience
Related Tags:
1. A new project, in addition quoted Ajax.dll cited, in Ajax.dll download compressed inside.
2. HttpHandler established in the web.config inside the <configuration>
<system.web>
<httpHandlers>
<add Verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax" />
</ HttpHandlers>
...
<system.web>
</ Configuration> 3. DemoMethods new category, this category to achieve access to the client MAC address: using System;
Using System.Web;
Namespace AjaxSample
(
/ / /
/ / / Summary description for Methods.
/ / /
Public class DemoMethods
(
[Ajax.AjaxMethod]
Public string GetCustomerMac (string clientIP) / / para IP is the client's IP
(
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 ();
Process.StandardOutput.ReadToEnd string output = ();
Int length = output.IndexOf ( "MAC Address =");
If (length> 0)
(
Mac = output.Substring (length +14, 17);
)
Process.WaitForExit ();
Return mac.Replace ("-", ""). Trim ();
)
)
)
4. Write javascript, the new name of a default, js file as follows:
Function GetMac ()
(
Var clientIP = "192.168.0.1";
Document.getElementById ( "Mac"). DemoMethods.GetCustomerMac value = (clientIP). Value
Alert (DemoMethods.GetCustomerMac (clientIP). Value);
)
5. Placed in a Aspx pages of a button html
In the pages cited default.js:
INPUT in the onclick event in the onclick = "javascript: GetMac ()"
Value = "client access to IP" onclick = "javascript: GetMac ();">
6. Global.asax amend the Application_Start event, set the HandlerPath Ajax:
Protected void Application_Start (Object sender, EventArgs e)
(
Ajax.Utility.HandlerPath = "ajax";
)
Look at the effects of running. Is is not set in the server-side admission to the client's MAC address? ?
It must be noted that: The version of the. Net Ajax to manually add in the Global.asax Ajax.Utility.HandlerPath = "ajax" web.config configuration file must be added HttpHandler configuration information!
The new version of the development kit also does not have enough time experience, it is estimated that the new version will facilitate some may be removed manually set the Application_Start event in the Global.asax with Ajax.Utility.HandlerPath = "ajax", as well as other trouble set! Expect ing……
- Javascript Template Technology
- Ajax technology brought us?
- Fireworks Mengban technology
- WAP technology in the ASP 6
- CSS technology in the Gudongmen
- Web2.0 technology
- "Automatic steering" technology
- ActionScript2.0 Programming Technology Guide
- AJAX Technology of
- FlashMX technology in the voice of the shallow
- Dynamic CSS, rejuvenate technology
- WAP technology simple Interpretation
- Web technology
- Flash in the use of ASP technology
- CSS rejuvenate technology
- WAP technology in the ASP V.
- CSS Technology
- AJAX Technology
- Simple AJAX Technology
- Understand new technology: a comprehensive analysis WAP technology




