文件操作 - Login.aspx.cs
返回文件管理
返回主菜单
删除本文件
文件: E:\HostingSpaces\kimblycr\alex.kimbly.in\wwwroot\Login.aspx.cs
编辑文件内容
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; using System.Data; public partial class Login : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { HttpCookie loginCookie = Request.Cookies["Login"]; if (loginCookie != null) { string status = loginCookie.Values["Status"]; if (status == "true") { Response.Redirect("index.aspx"); } } } } protected void BtnLogin_Click(object sender, EventArgs e) { string UserName = txtUserName.Text; string Password = txtPassword.Text; string IsPaidUser = string.Empty; DataTable dt2 = SelectClass.GetCheckUserLoggedIn(UserName); if(dt2.Rows.Count > 0) { string IsLoggedIn = Convert.ToString(dt2.Rows[0][0]); if (IsLoggedIn.Equals("1") || IsLoggedIn.Equals("True")) { Response.Write("<script>alert('Already logged in from another device');</script>"); BtnLogin.Enabled = false; return; } } else { lblError.Visible = true; return; } DataTable dt = SelectClass.GetUsers(UserName, Password); if (dt.Rows.Count > 0) { lblError.Visible = false; IsPaidUser = Convert.ToString(dt.Rows[0]["IsPaidUser"]); if (IsPaidUser.Equals("1") || IsPaidUser.Equals("True")) { Response.Cookies["Login"].Value = "true"; Response.Cookies["Login"].Expires = DateTime.Now.AddDays(365); Response.Cookies["username"].Value = UserName; Response.Cookies["username"].Expires = DateTime.Now.AddDays(365); UpdateClass.SetUserLoggedIn(UserName); Response.Redirect("index.aspx"); } else { Response.Redirect("Payment.aspx?Email=" + UserName); } } else { lblError.Visible = true; } } }
修改文件时间
将文件时间修改为当前时间的前一年
删除文件