ajax.dll 与 ajaxpro.dll 实现ajax效果和在web.config文件中的配置(转载)
ajaxpro:
<httpHandlers>
<add verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro"/>
</httpHandlers>
ajax:
<httpHandlers>
<add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax"/>
</httpHandlers>
(2) 在具体的aspx文件中,在该例中test是我所建的项目名称
ajaxpro:
<script type="text/javascript" src="/test/ajaxpro/prototype.ashx"></script>
<script type="text/javascript" src="/test/ajaxpro/core.ashx"></script>
<script type="text/javascript" src="/test/ajaxpro/converter.ashx"></script>
<script type="text/javascript" src="/test/ajaxpro/test.ajaxprotest,test.ashx"></script>
ajax:
<script src="/test/cshop/ajax/common.ashx" type="text/javascript"></script>
<script src="/test/cshop/ajax/cshop.ajaxdllcom,cshop.ashx" type="text/javascript"></script>
(3) 在具体的类文件中
ajaxpro:
在函数前以" [AjaxPro.AjaxMethod()] "开头
ajax:
在函数前以" [Ajax.AjaxMethod()] "开头.
注:由于是用C#来写的.所以是以中括号来表示.如果ajax能在vb.net下运行的话.估计应该是如下方式:<Ajax.AjaxMethod()>
(4)ajax:
修改Global.asax的Application_Start事件,设置Ajax的HandlerPath :
protected void Application_Start(Object sender, EventArgs e)
{
Ajax.Utility.HandlerPath = "ajax";
}
注意的是:该版本的.net Ajax需要手工在中Global.asax加上Ajax.Utility.HandlerPath = "ajax";