<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="QYLogin.aspx.cs" Inherits="YTO.WeiXinService.QYLogin" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理登录界面</title>
<link href="CSS/login.css" rel="stylesheet" />
<link href="Images/2.ico" rel="icon" />
<script type="text/javascript" src="JS/jquery-1.11.0.js"></script>
<script>
$(document).ready(function () {
$("#logo").css("margin-top", ($(window).height() - ) / + "px");
$("input[name='username']").focus();
// checkform();
$("#forget-password").click(function (e) {
$("#loginform").hide();
$("#forgetPwd").show();
e.preventDefault();
});
$("#btnforgetsubmit").click(function (e) {
$("#loginform").slideDown();
$("#forgetPwd").slideUp();
e.preventDefault();
});
});
</script>
</head>
<body>
<div id="logo">
<img alt="HongCMS" src="Images/logo-login.png">
</div>
<div id="login">
<form name="form1" method="post" runat="server" action="QYLogin.aspx?frm=Login">
<div id="loginform">
<asp:Label ID="errorWarning" Text="" runat="server" />
<p id="info">请输入用户名和密码</p>
<div class="control-group">
<span class="icon-user"></span>
<asp:TextBox ID="username" runat="server" Text=""></asp:TextBox>
<asp:RequiredFieldValidator ErrorMessage="" ControlToValidate="username" runat="server" />
</div>
<div class="control-group">
<span class="icon-lock"></span>
<asp:TextBox ID="pwd" runat="server" Text="" TextMode="Password" />
<asp:RequiredFieldValidator ErrorMessage="" ControlToValidate="pwd" runat="server" />
</div>
<div class="remember-me">
<input id="rm" value="" type="checkbox" name="remember">
<label for="rm">记住我</label>
<a id="forget-password" href="#">忘记密码?</a>
</div>
<div class="login-btn">
<asp:Button ID="btnlogin" Text="登 录" runat="server" OnClientClick="return checkform()" OnClick="btnlogin_Click" />
</div>
</div>
<%--
<form id=forgotform class=hide name="form2" method=post runat="server" action="QYLogin.aspx?frm=ForgetPwd">--%>
<div id="forgetPwd" style="display:none;">
<p id="info2">请输入Email地址重设密码.</p>
<div class="control-group">
<span class="icon-mail"></span>
<asp:TextBox runat="server" Text="" />
</div>
<div class="login-btn forget-btn">
<asp:Button ID="btnforgetsubmit" Text="提 交" runat="server" OnClick="btnforgetsubmit_Click" />
</div>
</div>
</form>
</div>
<div id="login-copyright"><a href="http://www.yto.net.cn" target="_blank">www.yto.net.cn</a> </div> </body>
</html>

2.后台代码

using System;
using System.Collections.Generic;
using System.Web.UI;
using YTO.WeiXin.Core;
using YTO.WeiXin.Model; namespace YTO.WeiXinService
{
public partial class QYLogin : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ }
protected void btnlogin_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
string userName1 = username.Text.ToString().Trim();
string pwd1 = pwd.Text.ToString().Trim();
AccountInfo[] account = AccessTo.account;
IList<AccountInfo> acclist = new List<AccountInfo>();
foreach (var item in account)
{
if (item.Username == userName1 && item.Pwd == pwd1)
{
acclist.Add(item);
}
}
if (acclist.Count > )
{
//Session[""]="";
CustomizeSession CustSession = new CustomizeSession();
CustSession.SetSession("yto_qiyun_session_username", acclist[].Username);
CustSession.SetSession("yto_qiyun_session_pwd", acclist[].Pwd);
string remember = Request.Form["remember"];
if (remember == "")
{
Response.Cookies["yto_qiyun_username"].Value = acclist[].Username;
Response.Cookies["yto_qiyun_username"].Expires = DateTime.Now.AddDays();
Response.Cookies["yto_qiyun_pwd"].Value = acclist[].Pwd;
Response.Cookies["yto_qiyun_pwd"].Expires = DateTime.Now.AddDays();
}
Response.Redirect("Management/AuthManagement.aspx");
}
else
{
errorWarning.Text = "*用户名或密码错误,请重新输入!";
errorWarning.Style["display"] = "inline";
username.Text = "";
pwd.Text = "";
//Response.Redirect("QYLogin.aspx");
//Response.Write("<Script language='JavaScript'>alert('用户名或者密码错误!');</Script>");
}
}
else
{
errorWarning.Text = "*用户名或密码不可以为空!";
errorWarning.Style["display"] = "inline";
username.Text = "";
pwd.Text = "";
}
}
protected void btnforgetsubmit_Click(object sender, EventArgs e)
{ }
}
}

Asp登陆的更多相关文章

  1. asp登陆例子,asp,mssql,登陆

    login.aspx文件 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="log ...

  2. python实现域账号登陆

    需求:公司的网路比较变态,每天到了24点自动断开,为了避免一台测试机断网,用python做了一个自动登录 原理:时间到了24点的时候,每隔10秒检测是否可以ping通www.baidu.com,如果p ...

  3. Sql-Server应用程序的高级注入

    本文作者:Chris Anley 翻译: luoluo [luoluonet@hotmail.com] [目 录] [概要] [介绍] [通过错误信息获取信息] [更深入的访问] [xp_cmdshe ...

  4. SQL手工注入

    site:xx.cn  inurl:asp?id= //找文章 xx.cn/pth/onews.asp?id=243' //试注入 xx.cn/pth/onews.asp?id=243 order b ...

  5. Windows Server 2008下asp+access无法登陆问题总结

    今日把一套陈旧的企业办公平台部署至公司新采购的服务器,因为在本机windows7环境已经反复测试通过.本以为分分钟完成的事情,结果折腾了我2天.服务器系统:windows server 2008 r2 ...

  6. asp.net 登陆验证 Form表单验证的3种方式 FormsAuthentication.SetAuthCookie;FormsAuthentication.RedirectFromLoginPage;FormsAuthenticationTicket

    我们在登陆成功后,使用下面的3种方法,都是同一个目的:创建身份验证票并将其附加到 Cookie, 当我们用Forms认证方式的时候,可以使用HttpContext.Current.User.Ident ...

  7. Asp.Net中Ajax实现登陆判断

    Default.aspx: <head runat="server"> <title>无标题页</title> <script type= ...

  8. Asp.net Form登陆认证的回顾学习

    asp.net网站中,我最常用的就是Form认证了,在实现登陆时,利用Form认证实现用户的访问权限,哪些页面是可以匿名登陆,哪些页面需要认证后才能访问,哪些页面不能访问等等权限.我还可在登陆时,使用 ...

  9. ASP.net(C#)利用SQL Server实现注册和登陆功能

    说说我现在吧,楼主现在从事的事IT行业,主攻DotNet技术:当然这次上博客园我也是有备而来,所有再次奉献鄙人拙作,以飨诸位,望诸位不吝赐教. 世界上大多数的工作都是熟练性的工种,编程也不例外,做久了 ...

随机推荐

  1. Longest Consecutive Sequence [LeetCode]

    Given an unsorted array of integers, find the length of the longest consecutive elements sequence. F ...

  2. 张艾迪(创始人):发明整个世界+224C个国家

    Eidyzhang:发明整个世界+224C个国家 Eidyzhang: Genius.Founder.CEO.23 I 世界级最高级创始人.世界最高级FounderCEO 出生在亚洲中国.Eidyzh ...

  3. Java 集合系列 11 hashmap 和 hashtable 的区别

    java 集合系列目录: Java 集合系列 01 总体框架 Java 集合系列 02 Collection架构 Java 集合系列 03 ArrayList详细介绍(源码解析)和使用示例 Java ...

  4. ZooKeeper(3.4.5) 使用Curator监听事件

    转载:http://www.mamicode.com/info-detail-494364.html 标签: ZooKeeper原生的API支持通过注册Watcher来进行事件监听,但是Watcher ...

  5. fr

    8.3 credit sales(bad debt , ar) method1:direct write off method2:allowance method for bad debt allow ...

  6. linux shell 当前时间

    #!/bin/bashdatestr=`date --date='today' "+%Y-%m-%d %H:%M:%S"`echo $datestr

  7. 【源码下载】分享一个支持自安装自卸载的Windows服务

    NetworkComms网络通信框架序言 这个程序来自  www.codeproject.com 具体的出处就忘了 服务器端的程序,我一般采用在windows服务中调用打开的方式,这样既能看到界面,又 ...

  8. JAVA EE企业级开发四步走完全攻略 [转]

    http://bbs.51cto.com/thread-550558-1.html 本文是J2EE企业级开发四步走完全攻略索引,因内容比较广泛,涉及整个JAVA EE开发相关知识,这是一个长期的计划, ...

  9. Swift - 自动布局库SnapKit的使用详解4(样例1:实现一个登录页面)

    前面的几篇文章讲解了自动布局库SnapKit的使用方法.本文通过一个完整的样例(登录页面)来演示在实际项目中如何使用SnapKit来实现自动化布局的.1,效果图如下

  10. c++普通高精除单精

    //没有在网上测试 //手测几组无误 //如有错误,还望指出,不胜感激. #include<cstdio>#include<cstring>int a1[600],a2,a4[ ...