asp.net登录不了

问题描述

在adminsys文件夹里面,有个Default.aspx文件,是登录入口,输入用户名跟密码老是提示“用户名密码错误,登录失败”不知道什么问题,查看了数据库里面Admin表的用户名和密码,发现我输入的用户名跟密码都是没错的,请高手帮忙啊!(1)/adminsys/Default.aspx代码如下:<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="Adminsys_Default"%><htmlxmlns="http://www.w3.org/1999/xhtml"><headrunat="server"><title>后台登录</title><linkhref="../Adminsys/ML_style.css"rel="stylesheet"type="text/css"/></head><bodystyle="background-image:none"><formid="form1"runat="server"><divstyle="text-align:center;margin-top:100px;"><tablestyle="width:424px;height:293px;"border="0"cellpadding="0"cellspacing="0"><tr><tdstyle="width:429px;height:28px;background:url(images/we_1.gif);color:White;"valign="bottom"align="left"><strong>&nbsp;&nbsp;&nbsp;<asp:LabelID="lbl_Title"runat="server"Text=""></asp:Label></strong></td></tr><tr><tdstyle="height:126px;width:429px;"align="center"><asp:ImageID="adImg"runat="server"ImageUrl="images/we_2.gif"/></td></tr><tr><tdstyle="height:119;background:url(images/we_3.gif);width:429px"align="center"><tablewidth="100%"border="0"cellpadding="3"cellspacing="0"><tr><tdvalign="middle"style="width:128px;height:24px;"align="right"><b>用户名:</b></td><tdvalign="middle"align="left"><asp:TextBoxID="txt_username"runat="server"Style="border-right:#7b9fbe1pxsolid;border-top:#7b9fbe1pxsolid;font-size:12px;background:#f9f9f9;border-left:#7b9fbe1pxsolid;width:120px;border-bottom:#7b9fbe1pxsolid;height:18px"></asp:TextBox><asp:RequiredFieldValidatorID="valrUserName"runat="server"ErrorMessage="请输入管理员用户名!"ControlToValidate="txt_username"></asp:RequiredFieldValidator></td></tr><tr><tdvalign="middle"align="right"style="height:24px;width:128px;"><b>密码:</b></td><tdvalign="middle"align="left"><asp:TextBoxID="txt_pwd"runat="server"Style="border-right:#7b9fbe1pxsolid;border-top:#7b9fbe1pxsolid;font-size:12px;background:#f9f9f9;border-left:#7b9fbe1pxsolid;width:120px;border-bottom:#7b9fbe1pxsolid;height:18px"TextMode="Password"></asp:TextBox><asp:RequiredFieldValidatorID="valrPWD"runat="server"ControlToValidate="txt_pwd"ErrorMessage="请输入管理员密码!"></asp:RequiredFieldValidator></td></tr><tr><tdvalign="middle"align="right"style="height:24px;width:128px;"><b>验证码:</b></td><tdvalign="middle"align="left"><asp:TextBoxID="txt_ValidateNum"runat="server"Style="border-right:#7b9fbe1pxsolid;border-top:#7b9fbe1pxsolid;font-size:12px;background:#f9f9f9;border-left:#7b9fbe1pxsolid;width:60px;border-bottom:#7b9fbe1pxsolid;height:18px"></asp:TextBox>&nbsp;&nbsp;<asp:ImageID="ValidateNumber"runat="server"ImageUrl="~/Adminsys/chkcode/Image.aspx"ImageAlign="AbsMiddle"/><asp:RequiredFieldValidatorID="valrCode"runat="server"ControlToValidate="txt_ValidateNum"ErrorMessage="请输入验证码!"></asp:RequiredFieldValidator></td></tr><tr><tdvalign="middle"colspan="2"align="center"style="height:30px"><asp:ButtonID="btnSub"runat="server"Text="登录"OnClick="btnSub_Click"/></td></tr></table></td></tr><tr><tdstyle="width:429px"align="center"><asp:ImageID="Image1"runat="server"ImageUrl="~/Adminsys/images/we_5.gif"/></td></tr></table></div></form></body></html>(2)/adminsys/Default.aspx.cs文件(包含“登录”控件)代码如下:usingSystem;usingSystem.Data;usingSystem.Configuration;usingSystem.Collections;usingSystem.Web;usingSystem.Web.Security;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Web.UI.HtmlControls;usingSystem.Data.SqlClient;publicpartialclassAdminsys_Default:System.Web.UI.Page{protectedvoidPage_Load(objectsender,EventArgse){if(!IsPostBack){lbl_Title.Text=Page.Title=Convert.ToString(Application["siteName"])+"后台管理系统";}}protectedvoidbtnSub_Click(objectsender,EventArgse){stringuname=txt_username.Text.ToString();stringpwd=txt_pwd.Text.ToString();stringvalidateNum=txt_ValidateNum.Text.ToString();if(validateNum==(string)Session["CheckCode"]){string[]userInfo=admin.login(uname,pwd);if(userInfo[2].Equals(pwd)){Session["userID"]=userInfo[0];Session["userName"]=userInfo[1];Session["pwd"]=userInfo[2];Response.Redirect("admin_main.aspx");}else{Response.Write(jaylee.Msg("","用户名密码错误,登录失败!"));}}else{Response.Write(jaylee.Msg("","验证码输入错误!"));}}}

解决方案

解决方案二:
string[]userInfo=admin.login(uname,pwd);admin.login返回的是什么?if(userInfo[2].Equals(pwd))这个判断是正确的吗?
解决方案三:
一楼字数限制,写到这里来。(3)/web.config文件代码如下:<?xmlversion="1.0"?><!--注意:除了手动编辑此文件以外,您还可以使用Web管理工具来配置应用程序的设置。可以使用VisualStudio中的“网站”->“Asp.Net配置”选项。设置和注释的完整列表在machine.config.comments中,该文件通常位于WindowsMicrosoft.NetFrameworkv2.xConfig中--><configuration><appSettings><addkey="dbPath"value="~/App_Data/dongtundu.mdb"/><addkey="imagesfolder"value="~/upLoadFile/"/><addkey="yuanimg"value="~/upLoadFile/"/></appSettings><connectionStrings/><system.web><httpHandlers/><!--设置文件上传最大值,预设200M--><httpRuntimemaxRequestLength="204800"/><!--设置sessionStatemode="StateServer"将session保IIS进程外的进程中需要开启ASP.NET状态服务InProc--><sessionStatemode="StateServer"stateConnectionString="tcpip=127.0.0.1:42424"></sessionState><!--设置compilationdebug="true"将调试符号插入已编译的页面中。但由于这会影响性能,因此只在开发过程中将此值设置为true。--><!--设置compilationdebug="true"将调试符号插入已编译的页面中。但由于这会影响性能,因此只在开发过程中将此值设置为true。--><compilationdebug="true"><assemblies><addassembly="System.Design,Version=2.0.0.0,Culture=neutral,PublicKeyToken=B03F5F7F11D50A3A"/><addassembly="System.Windows.Forms,Version=2.0.0.0,Culture=neutral,PublicKeyToken=B77A5C561934E089"/></assemblies></compilation><!--通过<authentication>节可以配置ASP.NET使用的安全身份验证模式,以标识传入的用户。--><authenticationmode="Windows"/><!--如果在执行请求的过程中出现未处理的错误,则通过<customErrors>节可以配置相应的处理步骤。具体说来,开发人员通过该节可以配置要显示的html错误页以代替错误堆栈跟踪。<customErrorsmode="RemoteOnly"defaultRedirect="GenericErrorPage.htm"><errorstatusCode="403"redirect="NoAccess.htm"/><errorstatusCode="404"redirect="FileNotFound.htm"/></customErrors>--></system.web></configuration>(4)/App_code/admin.cs文件代码如下:usingSystem;usingSystem.Data;usingSystem.Configuration;usingSystem.Web;usingSystem.Web.Security;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Web.UI.HtmlControls;usingSystem.Data.OleDb;///<summary>///admin的摘要说明///</summary>publicclassadmin{publicadmin(){////TODO:在此处添加构造函数逻辑//}publicstaticstring[]login(stringuname,stringpwd){string[]userInfo=newstring[]{"userID","userName","pwd"};OleDbDataReaderdr=(OleDbDataReader)OleDbHelper.ExecuteReader(CommandType.Text,"select*fromAdminwhereusername='"+jaylee.replacesql(uname).ToString()+"'andpassword='"+jaylee.to32MD5(jaylee.replacesql(pwd).ToString()).ToString()+"'");if(dr.HasRows){dr.Read();if(dr["password"].ToString()==jaylee.to32MD5(jaylee.replacesql(pwd).ToString()).ToString()){userInfo[0]=dr["id"].ToString();userInfo[1]=dr["userName"].ToString();userInfo[2]=pwd;}}dr.Close();returnuserInfo;}publicstaticboolchkoldpwd(stringuname,stringpwd){if(Convert.ToInt32(OleDbHelper.ExecuteScalar(CommandType.Text,"selectcount(0)fromadminwhereusername='"+jaylee.replacesql(uname).ToString()+"'andpassword='"+jaylee.to32MD5(jaylee.replacesql(pwd).ToString()).ToString()+"'"))>0){returntrue;}else{returnfalse;}}publicstaticstringchklogin(stringuname){stringstrMsg="";if(uname==null||uname.Length<=0){strMsg=jaylee.Msg("Default.aspx","登录超时,请重新登录!","parent");}returnstrMsg;}publicstaticstringchkflag(intflagID){stringflagBox=Convert.ToString(HttpContext.Current.Session["flag"]);flagBox=","+flagBox+",";stringstrMsg="";intflag=flagBox.IndexOf(","+flagID.ToString()+",");if(flag<=0){strMsg=jaylee.Msg("","你没有权限访问此页面!");}returnstrMsg;}publicstaticboolchkflagb(intflagID){stringflagBox=Convert.ToString(HttpContext.Current.Session["flag"]);flagBox=","+flagBox+",";intflag=flagBox.IndexOf(","+flagID.ToString()+",");if(flag<=0){returnfalse;}else{returntrue;}}}
解决方案四:
接上面(5)/App_Code/OleDbHelper.cs代码如下:usingSystem;usingSystem.Data;usingSystem.Configuration;usingSystem.Web;usingSystem.Web.Security;usingSystem.Web.UI;usingSystem.Web.UI.HtmlControls;usingSystem.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Data.OleDb;usingSystem.Collections;///<summary>///SummarydescriptionforOleDbHelper///</summary>publicclassOleDbHelper{publicstaticstringstrConnection="Provider=Microsoft.Jet.OLEDB.4.0;DataSource="+HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["dbPath"].ToString());privatestaticHashtableparmCache=Hashtable.Synchronized(newHashtable());#regionExecuteNonQuerypublicstaticintExecuteNonQuery(stringconnectionString,CommandTypecmdType,stringcmdText,paramsOleDbParameter[]commandParameters){OleDbCommandcmd=newOleDbCommand();using(OleDbConnectionconn=newOleDbConnection(connectionString)){PrepareCommand(cmd,conn,null,cmdType,cmdText,commandParameters);intval;try{val=cmd.ExecuteNonQuery();}finally{cmd.Parameters.Clear();conn.Close();}returnval;}}publicstaticintExecuteNonQuery(CommandTypecmdType,stringcmdText,paramsOleDbParameter[]commandParameters){OleDbCommandcmd=newOleDbCommand();using(OleDbConnectionconn=newOleDbConnection(strConnection)){PrepareCommand(cmd,conn,null,cmdType,cmdText,commandParameters);intval;try{val=cmd.ExecuteNonQuery();}finally{cmd.Parameters.Clear();conn.Close();}returnval;}}publicstaticintExecuteNonQuery(stringcmdText,paramsOleDbParameter[]commandParameters){OleDbCommandcmd=newOleDbCommand();using(OleDbConnectionconn=newOleDbConnection(strConnection)){PrepareCommand(cmd,conn,null,CommandType.StoredProcedure,cmdText,commandParameters);intval;try{val=cmd.ExecuteNonQuery();}finally{cmd.Parameters.Clear();conn.Close();}returnval;}}publicstaticintExecuteNonQuery(OleDbConnectionconnection,CommandTypecmdType,stringcmdText,paramsOleDbParameter[]commandParameters){OleDbCommandcmd=newOleDbCommand();PrepareCommand(cmd,connection,null,cmdType,cmdText,commandParameters);intval;try{val=cmd.ExecuteNonQuery();}finally{cmd.Parameters.Clear();connection.Close();}returnval;}#endregion#regionExecuteReaderpublicstaticOleDbDataReaderExecuteReader(stringconnectionString,CommandTypecmdType,stringcmdText,paramsOleDbParameter[]commandParameters){OleDbCommandcmd=newOleDbCommand();OleDbConnectionconn=newOleDbConnection(connectionString);OleDbDataReaderrdr;try{PrepareCommand(cmd,conn,null,cmdType,cmdText,commandParameters);rdr=cmd.ExecuteReader(CommandBehavior.CloseConnection);}finally{cmd.Parameters.Clear();}returnrdr;}publicstaticOleDbDataReaderExecuteReader(CommandTypecmdType,stringcmdText,paramsOleDbParameter[]commandParameters){OleDbCommandcmd=newOleDbCommand();OleDbConnectionconn=newOleDbConnection(strConnection);OleDbDataReaderrdr;try{PrepareCommand(cmd,conn,null,cmdType,cmdText,commandParameters);rdr=cmd.ExecuteReader(CommandBehavior.CloseConnection);}finally{cmd.Parameters.Clear();}returnrdr;}publicstaticOleDbDataReaderExecuteReader(stringcmdText,paramsOleDbParameter[]commandParameters){OleDbCommandcmd=newOleDbCommand();OleDbConnectionconn=newOleDbConnection(strConnection);OleDbDataReaderrdr;try{PrepareCommand(cmd,conn,null,CommandType.StoredProcedure,cmdText,commandParameters);rdr=cmd.ExecuteReader(CommandBehavior.CloseConnection);}finally{cmd.Parameters.Clear();//conn.Close();}returnrdr;}#endregion#regionExecuteScalarpublicstaticobjectExecuteScalar(stringconnectionString,CommandTypecmdType,stringcmdText,paramsOleDbParameter[]commandParameters){OleDbCommandcmd=newOleDbCommand();using(OleDbConnectionconnection=newOleDbConnection(connectionString)){PrepareCommand(cmd,connection,null,cmdType,cmdText,commandParameters);objectval;try{val=cmd.ExecuteScalar();}finally{cmd.Parameters.Clear();connection.Close();}returnval;}}publicstaticobjectExecuteScalar(CommandTypecmdType,stringcmdText,paramsOleDbParameter[]commandParameters){OleDbCommandcmd=newOleDbCommand();using(OleDbConnectionconnection=newOleDbConnection(strConnection)){PrepareCommand(cmd,connection,null,cmdType,cmdText,commandParameters);objectval;try{val=cmd.ExecuteScalar();}finally{cmd.Parameters.Clear();connection.Close();}returnval;}}
解决方案五:
接上面publicstaticobjectExecuteScalar(stringcmdText,paramsOleDbParameter[]commandParameters){OleDbCommandcmd=newOleDbCommand();using(OleDbConnectionconnection=newOleDbConnection(strConnection)){PrepareCommand(cmd,connection,null,CommandType.StoredProcedure,cmdText,commandParameters);objectval;try{val=cmd.ExecuteScalar();}finally{cmd.Parameters.Clear();connection.Close();}returnval;}}publicstaticobjectExecuteScalar(OleDbConnectionconnection,CommandTypecmdType,stringcmdText,paramsOleDbParameter[]commandParameters){OleDbCommandcmd=newOleDbCommand();PrepareCommand(cmd,connection,null,cmdType,cmdText,commandParameters);objectval;try{val=cmd.ExecuteScalar();}finally{cmd.Parameters.Clear();connection.Close();}returnval;}#endregion#regionExecuteDataSetpublicstaticDataSetExecuteDataSet(stringconnectionString,CommandTypecmdType,stringcmdText){OleDbConnectionOleDbDataConn=newOleDbConnection(connectionString);OleDbCommandOleDbComm=newOleDbCommand(cmdText,OleDbDataConn);OleDbComm.CommandType=cmdType;OleDbDataAdapterOleDbDA=newOleDbDataAdapter(OleDbComm);DataSetDS=newDataSet();OleDbDA.Fill(DS);OleDbDataConn.Close();returnDS;}publicstaticDataSetExecuteDataSet(CommandTypecmdType,stringcmdText){OleDbConnectionOleDbDataConn=newOleDbConnection(strConnection);OleDbCommandOleDbComm=newOleDbCommand(cmdText,OleDbDataConn);OleDbComm.CommandType=cmdType;OleDbDataAdapterOleDbDA=newOleDbDataAdapter(OleDbComm);DataSetDS=newDataSet();OleDbDA.Fill(DS);OleDbDataConn.Close();returnDS;}publicstaticOleDbDataAdapterExecuteDataAdapter(CommandTypecmdType,stringcmdText){OleDbConnectionOleDbDataConn=newOleDbConnection(strConnection);OleDbCommandOleDbComm=newOleDbCommand(cmdText,OleDbDataConn);OleDbComm.CommandType=cmdType;OleDbDataAdapterOleDbDA=newOleDbDataAdapter(OleDbComm);//OleDbDA.Fill(ds,tbl);OleDbDataConn.Close();returnOleDbDA;}publicstaticDataSetExecuteDataSet(stringcmdText){OleDbConnectionOleDbDataConn=newOleDbConnection(strConnection);OleDbCommandOleDbComm=newOleDbCommand(cmdText,OleDbDataConn);OleDbComm.CommandType=CommandType.StoredProcedure;OleDbDataAdapterOleDbDA=newOleDbDataAdapter(OleDbComm);DataSetDS=newDataSet();OleDbDA.Fill(DS);OleDbDataConn.Close();returnDS;}publicstaticDataSetExecuteDataSet(stringconnectionString,CommandTypecmdType,stringcmdText,paramsOleDbParameter[]OleDbparams){OleDbConnectionOleDbDataConn=newOleDbConnection(connectionString);OleDbCommandOleDbComm=AddOleDbParas(OleDbparams,cmdText,cmdType,OleDbDataConn);OleDbDataAdapterOleDbDA=newOleDbDataAdapter(OleDbComm);DataSetDS=newDataSet();OleDbDA.Fill(DS);OleDbDataConn.Close();returnDS;}publicstaticDataSetExecuteDataSet(CommandTypecmdType,stringcmdText,paramsOleDbParameter[]OleDbparams){OleDbConnectionOleDbDataConn=newOleDbConnection(strConnection);OleDbCommandOleDbComm=AddOleDbParas(OleDbparams,cmdText,cmdType,OleDbDataConn);OleDbDataAdapterOleDbDA=newOleDbDataAdapter(OleDbComm);DataSetDS=newDataSet();OleDbDA.Fill(DS);OleDbDataConn.Close();returnDS;}publicstaticDataSetExecuteDataSet(stringcmdText,paramsOleDbParameter[]OleDbparams){OleDbConnectionOleDbDataConn=newOleDbConnection(strConnection);OleDbCommandOleDbComm=AddOleDbParas(OleDbparams,cmdText,CommandType.StoredProcedure,OleDbDataConn);OleDbDataAdapterOleDbDA=newOleDbDataAdapter(OleDbComm);DataSetDS=newDataSet();OleDbDA.Fill(DS);OleDbDataConn.Close();returnDS;}#endregion#regionCacheParameterspublicstaticvoidCacheParameters(stringcacheKey,paramsOleDbParameter[]commandParameters){parmCache[cacheKey]=commandParameters;}#endregion#regionGetCachedParameterspublicstaticOleDbParameter[]GetCachedParameters(stringcacheKey){OleDbParameter[]cachedParms=(OleDbParameter[])parmCache[cacheKey];if(cachedParms==null)returnnull;OleDbParameter[]clonedParms=newOleDbParameter[cachedParms.Length];for(inti=0,j=cachedParms.Length;i<j;i++)clonedParms[i]=(OleDbParameter)((ICloneable)cachedParms[i]).Clone();returnclonedParms;}#endregion#regionPrepareCommandprivatestaticvoidPrepareCommand(OleDbCommandcmd,OleDbConnectionconn,OleDbTransactiontrans,CommandTypecmdType,stringcmdText,OleDbParameter[]cmdParms){if(conn.State!=ConnectionState.Open)conn.Open();cmd.Connection=conn;cmd.CommandText=cmdText;if(trans!=null)cmd.Transaction=trans;cmd.CommandType=cmdType;if(cmdParms!=null){foreach(OleDbParameterparmincmdParms)cmd.Parameters.Add(parm);}}#endregion#regionAddOleDbParasprivatestaticOleDbCommandAddOleDbParas(OleDbParameter[]OleDbParas,stringcmdText,CommandTypecmdType,OleDbConnectionOleDbDataConn){OleDbCommandOleDbComm=newOleDbCommand(cmdText,OleDbDataConn);OleDbComm.CommandType=cmdType;if(OleDbParas!=null){foreach(OleDbParameterpinOleDbParas){OleDbComm.Parameters.Add(p);}}returnOleDbComm;}#endregion
解决方案六:
你是不是在web.config中添加了权限设置啊?如果是请加FormsAuthentication.RedirectFromLoginPage(this.txtUserName.Text,false);退出时加System.Web.Security.FormsAuthentication.SignOut();
解决方案七:
亲,你这码发的,让人看的很蛋疼啊
解决方案八:
排个版啊
解决方案九:
你传过来的参数值能取到吗?代码看得有些乱
解决方案十:
引用1楼的回复:

string[]userInfo=admin.login(uname,pwd);admin.login返回的是什么?if(userInfo[2].Equals(pwd))这个判断是正确的吗?

这个我也看不太懂,还请高手相助啊!
解决方案十一:
引用7楼的回复:

排个版啊

好的,这个是我下载下来的模版
解决方案十二:
引用8楼的回复:

你传过来的参数值能取到吗?代码看得有些乱

附件发不了,怎么才能把整个站点文件发给您看看呢?
解决方案十三:
OleDbDataReaderdr=(OleDbDataReader)OleDbHelper.ExecuteReader(CommandType.Text,"select*fromAdminwhereusername='"+jaylee.replacesql(uname).ToString()+"'andpassword='"+jaylee.to32MD5(jaylee.replacesql(pwd).ToString()).ToString()+"'");你的OleDbHelper里面没有定义ExecuteReader(CommandTypecmdType,Stringsql)的方法啊你应该写成OleDbDataReaderdr=(OleDbDataReader)OleDbHelper.ExecuteReader(CommandType.Text,"select*fromAdminwhereusername='"+jaylee.replacesql(uname).ToString()+"'andpassword='"+jaylee.to32MD5(jaylee.replacesql(pwd).ToString()).ToString()+"'",null);啊
解决方案十四:
另外你打印出去数据库中去查,能查到数据吗System.Web.HttpContext.Current.Response.Write("select*fromAdminwhereusername='"+jaylee.replacesql(uname).ToString()+"'andpassword='"+jaylee.to32MD5(jaylee.replacesql(pwd).ToString()).ToString()+"'");
解决方案十五:
引用5楼的回复:

你是不是在web.config中添加了权限设置啊?如果是请加FormsAuthentication.RedirectFromLoginPage(this.txtUserName.Text,false);退出时加System.Web.Security.FormsAuthentication.SignOut();

这个是我下载下来的模版,怎么看是不是添加了权限设置呢?
其他方案:
引用13楼的回复:

另外你打印出去数据库中去查,能查到数据吗System.Web.HttpContext.Current.Response.Write("select*fromAdminwhereusername='"+jaylee.replacesql(uname).ToString()+"'andpassword='"+jaylee.to32MD5(jaylee.……

我用Access打开数据库,里面是有对应的用户名跟密码的
其他方案:
估计密码加密了的原因!!
其他方案:
引用16楼的回复:

估计密码加密了的原因!!

我也有想过这个问题,但我对这个还不熟,不知道怎么改,请赐教
其他方案:
引用12楼的回复:

OleDbDataReaderdr=(OleDbDataReader)OleDbHelper.ExecuteReader(CommandType.Text,"select*fromAdminwhereusername='"+jaylee.replacesql(uname).ToString()+"'andpassword='"+jaylee.to32MD5(jayle……

改了,还是不行啊
其他方案:
System.Web.HttpContext.Current.Response.Write("select*fromAdminwhereusername='"+jaylee.replacesql(uname).ToString()+"'andpassword='"+jaylee.to32MD5(jaylee.replacesql(pwd).ToString()).ToString()+"'");去数据库中手工查询看有结果吗
其他方案:
跟踪下if(dr["password"].ToString()==jaylee.to32MD5(jaylee.replacesql(pwd).ToString()).ToString())看看她们数据是什么?
其他方案:
引用19楼的回复:

System.Web.HttpContext.Current.Response.Write("select*fromAdminwhereusername='"+jaylee.replacesql(uname).ToString()+"'andpassword='"+jaylee.to32MD5(jaylee.replacesql(pwd).ToString()).ToSt……

嗯,有结果
其他方案:
引用20楼的回复:

跟踪下if(dr["password"].ToString()==jaylee.to32MD5(jaylee.replacesql(pwd).ToString()).ToString())看看她们数据是什么?

怎么跟踪呢,我菜鸟,不明白啊
其他方案:
设置断点
其他方案:
你登陆方法加密了账号和密码,在数据库里的数据没有加密。所以虽然你输入的和数据库的一样,但经过加密后就不一样了。所以就会登录失败。添加方法和登陆方法都要将密码加密。这样才能保持一致。
其他方案:
蛋疼的代码!!!!!!!!!!

时间: 2024-09-30 07:07:49

asp.net登录不了的相关文章

ASP用户登录模块的设计

ASP用户登录模块的设计 用户登录验证脚本,Chkpwd.asp <% '=======用户登录验证脚本======= '如果尚未定义Passed对象,则将其定义为false,表示没有通过验证 If IsEmpty(Session("Passed")) Then Session("Passed")=false End If   'Session("Passed")=False,表示尚未通过验证,则开始读取从表单传来的验证信息 If Sess

asp用户登录模块实例代码

 asp用户登录模块实例代码: 用户登录验证脚本,Chkpwd.asp 以下为引用的内容: <%  '=======用户登录验证脚本=======  '如果尚未定义Passed对象,则将其定义为false,表示没有通过验证  If IsEmpty(Session("Passed")) Then  Session("Passed")=false  End If  'Session("Passed")=False,表示尚未通过验证,则开始读取从

c# asp net-c# asp.net登录页面代码

问题描述 c# asp.net登录页面代码 作业,做一个简单的登录页面,与sql连接,但是总是出现错误,不能验证到已注册的用户,这里还没有写注册的代码,只是单纯的在已有账户中登录 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.Sql

我的ASP网站登录后台,访问返回了200,怎么解决

问题描述 我的ASP网站登录后台,访问返回了200,怎么解决 解决方案 解决方案二:200是什么,如果是htrpstatuscode的话,200就是服务器正确响应了解决方案三:我可以加你的QQ私聊的吗解决方案四: 解决方案五:引用3楼zxb478846231的回复:这个看你的浏览器控制台输出的什么错误.

asp 用户登录代码

文章提供一款简单的asp 用户登录代码,提供了从数据库教程连接到文件的登录以及用户在输入信息时js判断验证哈. <% 'dim databasename,conn,constr databasename="userman.mdb" constr="provider=microsoft.jet.oledb.4.0;data source=" & server.mappath(databasename) set conn=server.createobje

ASP.NET登录注册页面实现_实用技巧

如何利用Visual  studio 2010创建一个ASP网站? [文件]-->[新建]-->[网站]-->[ASP.Net网站]--[完成] 默认页面Default.aspx 创建以上界面: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="UserLogin.aspx.cs" Inherits="UserLogin" %> <

asp.net登录验证码实现方法_实用技巧

前端添加的标签和方法: 验证码: 复制代码 代码如下: <input id="txtVerifyCode" type="text" maxlength="5" style="line-height: 30px;  height: 30px; width: 80px;border:solid 1px #d4d4d4;" class="input"/> <img src=""

做asp.net登录页面,输入用户名,然后连接数据库查询用户名对应密码,最后匹配,就是查不到数据

问题描述 usingSystem;usingSystem.Data;usingSystem.Configuration;usingSystem.Collections;usingSystem.Web;usingSystem.Web.Security;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Web.UI.HtmlControls;usi

ASP用户登录代码

asp+access用户登录代码,an.mdb数据库名 fd表名 y_username用户名字段,y_password密码字段. loginnew.asp网页 <% dim username,password    username=request.form("username")  password=request.form("password")  set rs=server.createobject("adodb.recordset"