一个AJAX用户名验证问题!请大家帮忙指点下!
后台 CS文件
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class RegisterPage : PageBase
{
UserEntity user = new UserEntity();
protected void Page_Load(object sender, EventArgs e)
{
AjaxPro.Utility.RegisterTypeForAjax(typeof(RegisterPage));
}
[AjaxPro.AjaxMethod]
public string select(string username)
{
string a = "已存在! ";
string b = "可以使用 ";
// string username= Request.QueryString[ "username "].ToString();
string sql = "select * from BBS where bbsname= ' " + username + " ' ";
DataSet ds = DBAcess.GetDataSet(sql, true);
if (ds.Tables[0].Rows.Count > 0)
{
return a;
}
else
return b;
}
[AjaxPro.AjaxMethod]
public string pwd(string p1, string p2)
{
string a = "一致 ";
string b = "不一致 ";
if (p1 == p2)
{
return a;
}
else
return b;
}
}
前台文件 因为代码较长。我只贴出有关的部分。
<asp:Content ID = "reg " ContentPlaceHolderID = "Registerpage " runat = "server " >
<script language= "javascript " type= "text/javascript ">