. NET Ajax refresh technology without the initial experience

Related Tags:

  Have heard of Ajax technology, the legendary cattle is a very things, they claim that no refresh is actually on the web through javascript, and the use of asynchronous xmlhttp request, the realization of a set of web interface.    Unfortunately have not experienced, has to listen to friends PHP PHP used the Ajax development kits, and done a lot of cool things, Niche envy.    Today, under a. Net Ajax development kits, including the development kit version of ASP2.0 and current use of ASP1.1 Ajax, full address, see http://ajax.schwarz-interactive.de/, then started. 

  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…… 




Related articles:

Learning new techniques website: encryption static pages
  A couple of days ago to see someone asked encryption static pages, wrote the code slightly longer explain ideas:    Encryption: The first users with md5 A key encryption for B, then B or different source files S0 been the target file S1, the S1 into js variable.    Decr...
Search engine optimization: SEO criteria for the five gold
  As seo in China continued to heat up, with the international market continues to mature, have simple "mate + text labels, such as" seo approach has been to consider a comprehensive seo alternative formulas and procedures.    And the different search engines: google, yahoo...
"HillTop" On
  Editor's note: 2003 November 16 - the day a search engine may be an important milestone in history.    It is in all of this was known as the "Google Florida" update, Google ranking algorithm to a large-scale changes, and a lot of very good web site that ranks as a nig...
Betrayal axis breakthrough IDE
  First, I want to affirm that this title is exaggerated.    Is hoped that through this exaggeration can cause you to the attention ActionScript Flashers attention.    In fact, a Flasher, in particular experienced Flash4, Flash5 this group of people who are perennial throu...
Dreamweaver realize website rolling QQ online advisory function
  Design background: in the production of the Web, the production often placed in the web site will be the top menu page, so that when visitors here longer content of the Web, if you want to choose other menu, we will have to return to the website can choose other top menu.    QQ on ...