| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1068 人关注过本帖
标题:【求助】做了登录页面,调试没问题,但是在浏览器中登录没有反应,就如没有 ...
只看楼主 加入收藏
surpassyouuo
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2011-10-26
结帖率:80%
收藏
已结贴  问题点数:10 回复次数:3 
【求助】做了登录页面,调试没问题,但是在浏览器中登录没有反应,就如没有写后台一般!
登录的时候,页面闪烁一下,就没有反应了,而且验证码、密码、用户名填写错误也没有反应,查了很多资料都没有找到解决的办法,求教大哥哥大姐姐们帮忙呀!谢谢O(∩_∩)O谢谢
前台代码:
    <table class="style10" bgcolor="#FF99CC">
        <tr>
            <td>
                <span class="style17">登录</span></td>
        </tr>
        <tr>
            <td>
                登录名:
                <asp:TextBox ID="txtUserName" runat="server"></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtUserName"
                                    ErrorMessage="用户名必须填写">*</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>
                密&nbsp;&nbsp;码:
                <asp:TextBox ID="txtUserpass" runat="server" TextMode="Password"></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtUserpass"
                                    ErrorMessage="密码必须填写">*</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>
                验证码:
                <asp:TextBox ID="txtCode" runat="server" Width="60px"></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtCode"
                                    ErrorMessage="验证码必须填写">*</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
        <td>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <img style="cursor: hand; width: 76px;
                                        height: 21px" id="imgCode" src="Public/CheckCode.aspx"
                    alt="看不清,请点击我!" onclick="this.src=this.src+'?'" />
        </td>
        </tr>
        <tr>
        <td>
                                <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True"
                                    ShowSummary="False" Font-Size="12px" />
        </td></tr>
        <tr>
        <td>
            
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            <asp:LinkButton ID="linbtnRegister" runat="server" CausesValidation="False"
                PostBackUrl="~/Register.aspx">注册新用户</asp:LinkButton>
            
        </td>
        </tr>
        <tr>
            <td>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:Button ID="btnLog" runat="server" Text="登录" />
            &nbsp;
                <asp:Button ID="Button2" runat="server" Text="重置" />
            </td>
        </tr>
    </table>


后台代码如下:
using System;
using System.Data;
using System.Configuration;
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;
using System.Data.SqlClient;

public partial class Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void txtCode_TextChanged(object sender, EventArgs e)
    {

    }
    protected void btnLog_Click(object sender, EventArgs e)
    {
        string code = txtCode.Text;
        if (Request.Cookies["CheckCode"].Value == code)
        {
            SqlConnection con = new SqlConnection("server=.;database=db_XiGeYue;uid=sa;pwd=;");
            con.Open();
            string pass = FormsAuthentication.HashPasswordForStoringInConfigFile(txtUserpass.Text, "MD5");
            string sqlSel = "select count(*) from tb_userInfo where userName=@username and userPass=@userpass";
            SqlCommand com = new SqlCommand(sqlSel, con);
            com.Parameters.Add(new SqlParameter("username", SqlDbType.VarChar, 50));
            com.Parameters["username"].Value = txtUserName.Text;
            com.Parameters.Add(new SqlParameter("userpass", SqlDbType.VarChar, 50));
            com.Parameters["userpass"].Value = pass;
            if (Convert.ToInt32(com.ExecuteScalar()) > 0)
            {
                RegisterStartupScript("", "<script>alert('登录成功!')</script>");
                txtCode.Text = txtUserName.Text = "";
            }
            else
            {
                RegisterStartupScript("", "<script>alert('用户名或密码错误!')</script>");
            }
        }
        else
        {
            RegisterStartupScript("", "<script>alert('验证码输入错误!')</script>");
        }
    }

}
搜索更多相关主题的帖子: asp 验证码 用户名 server 
2011-11-06 14:11
surpassyouuo
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2011-10-26
收藏
得分:0 
其中过程图片见附件!谢谢啊!呵呵
2011-11-06 14:30
surpassyouuo
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2011-10-26
收藏
得分:0 
呵呵,没见到附件在哪儿,杯具了!
2011-11-06 14:33
winners
Rank: 6Rank: 6
来 自:济南
等 级:侠之大者
威 望:1
帖 子:105
专家分:416
注 册:2009-3-20
收藏
得分:10 
调试一下,看能进入后台吗
2011-11-07 07:58
快速回复:【求助】做了登录页面,调试没问题,但是在浏览器中登录没有反应,就如 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.050004 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved