这是一个登录页面的前台代码。<%@ 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 style="text-align: center">
<table style="width: 300px; height: 100px; border-right: #009900 1px solid; border-top: #009900 1px solid; font: menu; border-left: #009900 1px solid; border-bottom: #009900 1px solid;">
<tr>
<td colspan="2" style="border-right: #00cc00 1px dashed; border-top: #00cc00 1px dashed; font: menu; border-left: #00cc00 1px dashed; width: 100%; border-bottom: #00cc00 1px dashed; height: 22px; background-color: aliceblue">
管理登陆</td>
</tr>
<tr>
<td style="width:43px; border-right: #00cc00 1px dashed; border-top: #00cc00 1px dashed; font: menu; border-left: #00cc00 1px dashed; border-bottom: #00cc00 1px dashed; height: 21px; background-color: aliceblue;">
用户名:</td>
<td style="width: 41px; border-right: #00cc00 1px dashed; border-top: #00cc00 1px dashed; font: menu; border-left: #00cc00 1px dashed; border-bottom: #00cc00 1px dashed; height: 21px; background-color: aliceblue;" align="left">
<asp:TextBox ID="TextBox1" runat="server" Style="border-right: #009900 1px solid;
border-top: #009900 1px solid; font: menu; border-left: #009900 1px solid; border-bottom: #009900 1px solid" Width="100px"></asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 43px; height: 21px; border-right: #00cc00 1px dashed; border-top: #00cc00 1px dashed; font: menu; border-left: #00cc00 1px dashed; border-bottom: #00cc00 1px dashed; background-color: aliceblue;">
密 码:</td>
<td style="width: 41px; height: 21px; border-right: #00cc00 1px dashed; border-top: #00cc00 1px dashed; font: menu; border-left: #00cc00 1px dashed; border-bottom: #00cc00 1px dashed; background-color: aliceblue;" align="left">
<asp:TextBox ID="TextBox2" runat="server" Style="border-right: #009900 1px solid;
border-top: #009900 1px solid; font: menu; border-left: #009900 1px solid; border-bottom: #009900 1px solid" TextMode="Password" Width="100px"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2" style="height: 16px; border-right: #00cc00 1px dashed; border-top: #00cc00 1px dashed; font: menu; border-left: #00cc00 1px dashed; width: 100%; border-bottom: #00cc00 1px dashed; background-color: aliceblue;" align="center">
<asp:Button ID="Button1" runat="server" Style="font: menu; background-color: whitesmoke"
Text="登 陆" OnClick="Button1_Click" /></td>
</tr>
</table>
</div>
</div>
</form>
</body>
</html>
这是登录页面的后台代码: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
{
//download from 51aspx.com
protected void Page_Load(object sender, EventArgs e)
{ }
protected void Button1_Click(object sender, EventArgs e)
{
string login_name=ConfigurationSettings.AppSettings["login_name"];
string pwd = ConfigurationSettings.AppSettings["pwd"];
if(login_name==this.TextBox1.Text&&pwd==this.TextBox2.Text)
{
Session["admin"] = "binbin";
Response.Redirect("index.aspx");
}
else
{
Response.Redirect("login.aspx");
} }
}为什么没看到前台,在哪个地方调用了后台定义的这些函数呢,会自动执行吗
解决方案 »
- DataGridView数据源(ArrayList )排序问题
- C#如何判断整形变量不为空
- 前辈们会为WINDOWS PHONE 7开发应用软件吗?
- 一个加密解密的类,我在WEB里好用,到了WINFORM里不好用,大家给看下(急)
- DbProviderFactories起什么样的作用啊.
- 项目开发中遇到的一个问题(各位帮帮忙):GridView 添加一自己创建的TemplateField, 数据绑定以后,怎样取得TemplateField里面的control
- 高手看看这个菜鸟问题吧
- 小弟的画图问题
- 悲催的问题,求高手解决。。。
- 关于c#中的代表(delegate)问题
- 如何把秒以后的时刻(分秒)写入数据库SQL server?
- [求助]安装.Net Framework 4 引起系统崩溃
Text="登 陆" OnClick="Button1_Click" /></td>这个就是前台调用后台Button1_Click 事件的地方 Page_Load不需要前台调用,页面加载的时候会自动执行
Text="登 陆" OnClick="Button1_Click" />在这呢