⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 default.aspx.cs

📁 c#做的WEB disk
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Configuration;
using System.Data.SqlClient;
using System.Web.Security;
using webihClass;

namespace ConfirmWebDisk
{
	/// <summary>
	/// _default 的摘要说明。
	/// </summary>
	public class _default : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.TextBox HD_Password_Tb;
		protected System.Web.UI.WebControls.ImageButton loginbtn;
		protected System.Web.UI.WebControls.TextBox HD_Id_Tb;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			Session.Abandon();
			loginbtn.Attributes.Add("onclick","if(check()){return true;}else{return false;}");// 在此处放置用户代码以初始化页面
		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.loginbtn.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton1_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			string type;
			string typesize;
			string HD_wwwServer;
			string ConnectionString = ConfigurationSettings.AppSettings["ConnectionString"];
			SqlConnection connection = new SqlConnection(ConnectionString);
			SqlCommand Command = new SqlCommand("sp_login",connection);
			Command.CommandType = CommandType.StoredProcedure;
			
			Command.Parameters.Add("@HD_Type_HD_size",SqlDbType.VarChar,50,"HD_Type_HD_size");
			Command.Parameters.Add("@HiveDisk_Id",System.Data.SqlDbType.BigInt,32,"HiveDisk_Id");
			Command.Parameters.Add("@HiveDisk_User_Password",System.Data.SqlDbType.VarChar,20,"HiveDisk_User_Password");
			Command.Parameters.Add("@HD_wwwServer",SqlDbType.VarChar,50,"Hive_www");

			Command.Parameters["@HiveDisk_Id"].Value = HD_Id_Tb.Text;
			Command.Parameters["@HiveDisk_User_Password"].Value = HD_Password_Tb.Text;
			Command.Parameters["@HD_Type_HD_size"].Direction = ParameterDirection.Output;
			Command.Parameters["@HD_wwwServer"].Direction = ParameterDirection.Output;
			
			
			connection.Open();
			Command.ExecuteNonQuery();
			type = Command.Parameters["@HD_Type_HD_size"].Value.ToString();
			HD_wwwServer = Command.Parameters["@HD_wwwServer"].Value.ToString();
			connection.Close();

			if( type != "" && HD_wwwServer != "")
			{
				if(type.EndsWith("G"))
				{
					typesize = (Convert.ToInt16(type.Substring(0,type.Length-1))*1024).ToString();
				}
				else
				{
					typesize = type.Substring(0,type.Length-2);
				}
				Response.Cookies["UserInfo"]["IsLogin"] = "true";
				webihClass.iHiveIDClass iHClass = new iHiveIDClass();
				string idsha1 = iHClass.GetiHiveID( HD_Id_Tb.Text , typesize );
				
				Response.Write("<script>location.href='"+HD_wwwServer+"login.aspx?HiveID="+HD_Id_Tb.Text+"&iHiveID="+idsha1+"&typesize="+typesize+"'</script>");
			}
			else
			{
				Response.Write("<script>alert('用户名或者密码错误!禁止登录');</script>");
			}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -