易截截图软件、单文件、免安装、纯绿色、仅160KB

ASP.NET 登录界面

//default.aspx.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.Runtime.InteropServices;
using System.Configuration;
using System.Web.UI.WebControls;
using System.Web.Services.Description;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Button4.Attributes.Add("onclick", "window.open('Register.aspx')");//通过button4打开链接
string strConnection = ConfigurationManager.AppSettings["Str.Properties.Settings.masterConnectionString"].ToString();
SqlConnection objConnection = new SqlConnection(strConnection);
objConnection.Open();
SqlCommand cmd = new SqlCommand("select * from judging where name='" + TextBox1.Text.Trim() + "'", objConnection);
string sql = "select * from judging where name='" + TextBox1.Text + "'and password='" + TextBox2.Text + "'";
cmd.CommandText = sql;
/*
***********************************************************************************************
*判断是否有此ID,ExecuteScalar() return the first column of the first row in the result set.
*/
if (cmd.ExecuteScalar() == null)//无此用户
{
Label1.Text = "Sorry, please check your id and psw";
Button3.Visible = false;
}
else
{
Label1.Text ="Welcome to "+TextBox1.Text;
Button3.Visible = true;
}

}
protected void Button1_Click(object sender, EventArgs e)
{
Panel1.Visible = false;
Panel2.Visible = true;
}
protected void Button4_Click(object sender, EventArgs e)
{

}
protected void Button3_Click(object sender, EventArgs e)


相关文档:

ASP.NET页面生命周期

  有很多理由去解释理解ASP.NET页面生命周期是非常重要的,主要是要去理解什么地方放置什么特定的方法,什么时候我们应该设置什么相关的属性。如果去开发自定义的服务器控件,理解生命周期对纠正控件初始化时候的错误,以及使用view-state和后台代码设置属性是非常有用的。(控件事件只与ASP.NET页面相关)
 &nb ......

Asp.NET获取文件及其路径


【相对路径】
Request.ApplicationPath
/src
Path.GetDirectoryName(HttpContext.Current.Request.RawUrl )
\\src\\Xiaoshe
Context.Request.Path
/src/Xiaoshe/Xiaoshe_New.aspx
Context.Request.CurrentExecutionFilePath
/src/Xiaoshe/Xiaoshe_New.aspx
Context.Request.FilePath
/src/Xiaoshe/Xiaoshe ......

asp.net利用jquery的ajax方法来验证登陆的代码

许多程序员在做业务开发时往往会在服务器端做用户信息的验证,有没有考虑过用jquery的ajax方法来验证登陆呢?且效果比在服务器端写代码来验证好的多,页面无刷新即可实现实现登陆验证,代码也简单。
现在下面贴出来的是很简单的用jquery的ajax方法来验证登陆的代码,适合刚接触jquery的朋友学习。
前台页面代码:
<he ......

jQuery和ASP.NET结合使用

ASP.NET AJAX推出也有一段时间了,当初宣称的AJAX客户端脚本可以脱离服务器端脚本,在诸如html,php等平台上使用,但像微软不少其他产品一样,这个肥大的,性能低下,毫无艺术感的框架正在被大家所诟病。越来越多的人想要脱离这个客户端脚本,脱离AJAX提供的客户端控件,用更精炼更高效的框架来调用服务器端方法。很显然,目 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号