当前位置:编程学习 > C#/ASP.NET >>

错误55 当前上下文中不存在名称"u_nme"“u_pss”"verify",求助@

<%@ 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>
<link rel="stylesheet" href="CSS/normal.css" type="text/css">
</head>
<body>
<form id="login_form" runat="server" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr> 
    <td height="600" background="images/indexbg.gif"> <br /> <br /> <br /> <br /> 
      <br /> <br /> <br />
      <table width="427" border="0" align="center" cellpadding="0" cellspacing="0" class="tableborder">
        <tr>
          <td height="64" colspan="3" background="images/index_hz01.gif" > </td>
        </tr>
        <tr>
          <td width="3" style="line-height:1px;font-size:1px;" background="images/index_hz02.gif"></td>
          <td height="162" valign="top" background="images/index_hz03.gif" style="border-top:#666666 1px double"><br />
            <br />
              <table width="320" border="0" align="right" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="70" height="30"><div align="center" style="font-size:12px">用户名:</div></td>
                  <td><asp:TextBox ID="usrname" runat="server" BorderColor="#000000" BorderStyle="Double" Height="22px" font-weight="bold" font-size="13px" MaxLength="16" BorderWidth="1px"></asp:TextBox></td>
                  <td width="70"></td>
                </tr>
                <tr>
                  <td width="70" height="30"><div align="center" style="font-size:12px">密  码: </div></td>
                  <td><asp:TextBox ID="usrpass" runat="server" BorderColor="#000000" BorderStyle="Double" Height="22px" font-weight="bold" font-size="13px" MaxLength="16" TextMode="Password" BorderWidth="1px"></asp:TextBox></td>
                  <td width="70"></td>
                </tr>
                <tr>
                  <td width="70" height="30"><div align="center" style="font-size:12px">验证码:</div></td>
                  <td>
                      <asp:TextBox ID="verify" runat="server" BorderColor="Black" BorderWidth="1px" Font-Size="13px" Height="22px" MaxLength="4" BorderStyle="Double" Width="30px"></asp:TextBox>
                     
                    
                    </td>
                  <td width="70"></td>
                </tr>
                <tr>
                  <td height="40"> </td>
                  <td>
                  <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="images/index_hz04.gif" Width="83px" Height="33px" border="0" OnClick="ImageButton1_Click" /></td>
                  <td width="70"> </td>
                </tr>
            </table>
            </td>
          <td width="3" style="line-height:1px;font-size:1px;" background="images/index_hz02.gif"></td>
        </tr>
        <tr>
          <td height="127" colspan="3" background="images/index_hz05.gif">
               </td>
        </tr>
      </table></td>
  </tr>
</table>
</form>
</body>
</html>




using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;


public partial class Login : System.Web.UI.Page
{
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        //判断是否启用COOKIES
        if (Request.Cookies["cokies"] == null)
        {
            error.Text = "请启用Cookies";
            error.Visible = true;
            return;
        }
        //判断验证码
        if (String.Compare(Request.Cookies["CheckCode"].Value, verify.Text.ToString().Trim(), true) != 0)
        {
            error.Text = "<font color=red>验证码错误!</font>";
            error.Visible = true;
            return;
        }
        else//验证码通过
        {
            string usrname, usrpass;
            u_nme = usrname.Text;
            u_pss = Maticsoft.Common.zMD5.CreateMD5(usrpass.Text);
            Maticsoft.Model.memlst users_Model = new Maticsoft.Model.memlst();
        } 
    }
    protected void Page_Load(object sender, EventArgs e)
    {

    }
}
--------------------编程问答-------------------- 按照提示可以看出,可能是你的字段名称不致 --------------------编程问答-------------------- 字段名称是一样的啊
补充:.NET技术 ,  C#
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,