日期:2014-05-18  浏览次数:20488 次

asp.net用jquery实现ajax验证,实现已有用户名不可注册,怎么使用jquery啊?
asp.net用jquery实现ajax验证,实现数据库中已有的用户名不可再注册,使用jquery时总是出问题,得不到效果,高手方便的话发个完整的代码上来,跪谢
实现没分了各位帮帮忙急用这功能!!

------解决方案--------------------
http://blog.csdn.net/wangjun8868/archive/2008/09/23/2967007.aspx
------解决方案--------------------
Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default"%> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"> 
<title>主页</title> 
<script src="js/jquery-1.2.6.js" type="text/javascript"></script> 
<script src="js/thickbox.js" type="text/javascript"></script> 
<link type="text/css" href="css/thickbox.css" rel="Stylesheet" /> 
</head> 
<body> 
<form id="form1" runat="server"> 
<div style="margin-left:auto; margin-right:auto;width:400px;"> 
<a href="ajaxLogin.html?height=120&width=250&modal=false" class="thickbox" title="请登录"> 
我要进行JQUERY登录验证</a> 
<br /> 
账号:admin<br/> 
密码:admin<br /> 
</div> 

</form> 

</body> 
</html>
login.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="login.aspx.cs" Inherits="login" %> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"> 
<title>登录验证</title> 
</head> 
<body> 
<form id="form1" runat="server"> 
<div> 
 
</div> 
</form> 
</body> 
</html> 

login.aspx.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 login : System.Web.UI.Page 

protected void Page_Load(object sender, EventArgs e) 

//执行登录验证的方法 
checklogin(); 


public void checklogin() 

//获得登录页面POST过来的参数 
string username = Request.Params["id"].ToString(); 
string userpwd = Request.Params["pwd"].ToString(); 
if (username == "admin" && userpwd == "admin") 

//如果登录成功则构造这样序列化好的JSON格式的数据 
// 这里我用1来表示成功,大家可以随便用什么表示都可以 
Response.Write(CreareJson("这里面可以随便写点什么", 1)); 

else 

// 否则是这样的 
Response.Write( CreareJson("这里面可以随便写点什么", 0));