C# winform

博客园 首页 联系 订阅 管理

1.引入 AjaxPro.2.dll

2.在web.config文件中的<system.web>

 <httpHandlers>
   <add verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, Ajaxpro.2"/>
  </httpHandlers

基本设置已完成

使用

3.前台

<script>
    function CheckUser()
    {
        var result=Login.isRight('admin','123456');
        alert(result.value);
    }
    </script>

<input type="button" value="testajax" onclick="CheckUser()" />

4.后台

    4.1

  protected void Page_Load(object sender, EventArgs e)
    {
        //注册ajax
        if(!Page.IsPostBack)
        {
         AjaxPro.Utility.RegisterTypeForAjax(typeof(Login));
        }
      
    }

  4.2

  //判断用户名密码是否正确
    [AjaxPro.AjaxMethod]

  public int isRight(string userName, string userPwd)
    {
        int count = 0;
        try
        {
            count = bll.Exists(userName,userPwd);
        }
        catch (Exception)
        {

            throw;
        }
        return count;
    }

 

posted on 2010-11-24 16:35  fffdc  阅读(297)  评论(0编辑  收藏  举报