If you use. net2.0 and do not use vs2005. You only need to put ajaxpro.2.dll into the applicationProgramIn the bin folder, and only the following steps are required:
1. modify web. config
Add
<System. Web>
<Httphandlers>
<Add verb = "post, get" Path = "ajaxpro/*. ashx" type = "ajaxpro. ajaxhandlerfactory, ajaxpro.2"/>
</Httphandlers>
2. Add the ajaxmethod attribute to your. Net method.
[Ajaxpro. ajaxmethod]
Public datetime getservertime ()
{
Return datetime. now;
}
============== The following is an example of my own example ...... complete, only describes how to implement client access to server functions 1 <% @ Page Language = " C # " Autoeventwireup = " True " Codefile = " Testajaxpro. aspx. CS " Inherits = " Test_testajaxpro " %>
2
3 <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
4
5 < Html Xmlns = "Http://www.w3.org/1999/xhtml" >
6 < Head Runat = "Server" >
7 < Title > No title page </ Title >
8 < Script Type = "Text/JavaScript" >
9
10 Function Getservertime ()
11 {
12Test_testajaxpro.getservertime (getservertime_callback );
13}
14
15 Function Getservertime_callback (RES)
16 {
17Alert (res. value );
18}
19
20 </ Script >
21 </ Head >
22 < Body >
23 < Form ID = "Form1" Runat = "Server" >
24 < Div >
25 < Input Type = "Button" Onclick = "Getservertime ();" Value = "Test Ajax pro" />
26 </ Div >
27 </ Form >
28 </ Body >
29 </ Html >
30 1 Using System;
2 Using System. Data;
3 Using System. configuration;
4 Using System. collections;
5 Using System. Web;
6 Using System. Web. Security;
7 Using System. Web. UI;
8 Using System. Web. UI. webcontrols;
9 Using System. Web. UI. webcontrols. webparts;
10 Using System. Web. UI. htmlcontrols;
11
12 Using Ajaxpro;
13
14 Public Partial Class Test_testajaxpro: system. Web. UI. Page
15 {
16 Protected Void Page_load ( Object Sender, eventargs E)
17 {
18Ajaxpro. Utility. registertypeforajax (Typeof(Test_testajaxpro ));//Register JavaScript with the client in the. NET method for using JavaScript
19}
20
21 [Ajaxpro. ajaxmethod]
22 Public String Getservertime ()
23 {
24Return "The current time is:" +Datetime. now;
25}
26
27 }
28