网站后台登陆不了?急啊!请各位大侠,帮忙,在线等!
从服务器下载,网站到本机调试,其他都很正常,只有后台登陆有问题!小弟刚接触.NET请各位帮忙!急,在线等!
配置:
网站:c# .net WIN2003 IIS 数据库:sql2005
出现症状:
登陆后台 用户名密码填写正确,点击登陆后又跳转至登陆界面,如填写错误用户名密码,则显示填写错误。
登陆页面:/system/login.aspx
页面代码如下:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>项目管理系统</title>
<style type="text/css">
<!
-- body
{
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-- ></style>
<link href="css/css.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="147" background="images/top02.gif">
<img src="images/top03.gif" width="776" height="147" />
</td>
</tr>
</table>
<table width="562" border="0" align="center" cellpadding="0" cellspacing="0" class="right-table03">
<tr>
<td width="221">
<table width="95%" border="0" cellpadding="0" cellspacing="0" class="login-text01">
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="login-text01">
<tr>
<td align="center">
<img src="images/ico13.gif" width="107" height="97" />
</td>
</tr>
<tr>
<td height="40" align="center">
</td>
</tr>
</table>
</td>
<td>
<img src="images/line01.gif" width="5" height="292" />
</td>
</tr>
</table>
</td>
<td>
<form runat="server" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="31%" height="35" class="login-text02">
用户名称:<br />
</td>
<td width="69%">
<input name="uname" type="text" size="30" />
</td>
</tr>
<tr>
<td height="35" class="login-text02">
密 码:<br />
</td>
<td>
<input name="upasswd" type="password" size="32" />
</td>
</tr>
<tr>
<td height="35" class="login-text02">
验证图片:<br />
</td>
<td>
<img width="100" height="30" border="0" align="middle" src="checkcode.aspx">
</td>
</tr>
<tr>
<td height="35" class="login-text02">
请输入验证码:
</td>
<td>
<input name="code" type="text" size="30" />
</td>
</tr>
<tr>
<td height="35">
</td>
<td>
<asp:Button ID="btnlogin" runat="server" OnClick="btnlogin_Click" Text="确认登陆" class="right-button01"/>
<input name="Submit232" type="reset" class="right-button02" value="重 置" />
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
login.aspx.cs程序代码如下:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
namespace YD.Web.system
{
public partial class login : System.Web.UI.Page
{
string strEncode = "87654321";
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnlogin_Click(object sender, EventArgs e)
{
string syscode = Utils.GetCookie("CheckCode");
string inputcode = RequestClass.GetFormString("code");//syscode.Equals(inputcode)
if (syscode.Equals(inputcode))
{
string uname = RequestClass.GetFormString("uname");
string upasswd = RequestClass.GetFormString("upasswd");
string tpasswd = StringClass.MD5(upasswd);
string sqlwhere = " aname ='" + uname.Trim() + "' and apasswd='" + tpasswd + "'";
sh_admin member = new AdminBizImpl().GetBywhere(sqlwhere, null);
if (member != null)
{
if (member.isdel == 0)
{
Utils.WriteCookie("sk", "xxx", 120, "xxx.com");
Utils.WriteCookie("aid", member.aid.ToString(), strEncode, 120, "xxx.com");
Utils.WriteCookie("aname", member.aname, strEncode, 120, "xxx.com");
//Response.Write(Request.Cookies["aid"].Value);
//Response.Write(Utils.GetCookie("aid") + "--");
Response.Redirect("index.aspx");
}
else
{
AlertClass.AlertToPage("对不起,此用户已被屏蔽,请与管理员联系!", "login.aspx");
}
}
else
{
AlertClass.AlertToPage("用户名或密码错误!", "login.aspx");
}
}
else
{
AlertClass.AlertToPage("验证码错误", "login.aspx");
}
}
}
}