📄 client_sso.aspx.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.Data.SqlClient;
using System.Configuration;
using webihClass;
namespace ConfirmWebDisk.JLService
{
/// <summary>
/// Client_SSO 的摘要说明。
/// </summary>
public class Client_SSO : System.Web.UI.Page
{
string ticket;
private void Page_Load(object sender, System.EventArgs e)
{
/*try
{
ticket = Request.QueryString["ticket"].ToString();
}
catch
{
Response.Write("无效帐号!");return;
}
string OrgID;
string LoginID;
string ProdID;
string PurchaseID;
bool Admin;
//判断ticket
bool IsAthorized = true;
cn.kdsws.server.HarmonyServiceService TicketAthorized = new ConfirmWebDisk.cn.kdsws.server.HarmonyServiceService();
cn.kdsws.server.ValidateInfo TicketInfo = new ConfirmWebDisk.cn.kdsws.server.ValidateInfo() ;
TicketInfo = TicketAthorized.authentication(ticket);
IsAthorized = TicketInfo.valid;
if( IsAthorized == true )
{
//用户登录验证通过
OrgID = TicketInfo.productInfos[0].orgID;
LoginID = TicketInfo.productInfos[0].loginID;
ProdID = TicketInfo.productInfos[0].prodID;
PurchaseID = TicketInfo.productInfos[0].purchaseID;
Admin = TicketInfo.productInfos[0].admin;
if( Admin == true )
{
//当管理员帐号登陆
Response.Write("管理员账号不能直接使用网络硬盘,只能给子帐户授权使用!");
}
else
{*/
//企业用户账号登陆
//验证企业用户是否分配了使用权限
// LogicBase LB = new LogicBase();
// if(LB.ManageStatus(OrgID,ProdID) =="启用" && LB.UserStatus(LoginID,OrgID) == "启用" )
// {
//验证用户授权
// cn.kdsws.server.AuthorizationInfo Authorize = TicketAthorized.authorization( LoginID,"2233" ,ProdID,PurchaseID ,"web","192.168.0.1");
// if( Authorize.returnCode == 0)
login(GetHiveDiskByLoginID("User001"),"");
// else
//// Response.Write("<script>alert('"+Authorize.returnInfo+"!')</script>");
// }
// else
// {
// Response.Write("企业用户账号停用,或者企业管理员未购买此产品!");
// }
/* }
}
else
{
//用户登录验证失败
Response.Write("登录失败!");
}*/
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void login(string loginID ,string PassWord)
{
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("@HD_wwwServer",SqlDbType.VarChar,50,"Hive_www");
Command.Parameters["@HiveDisk_Id"].Value = loginID;
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";
LogicBase LB = new LogicBase();//在HD_Userv中改变
loginID = LB.VDiskId( Convert.ToInt64(loginID));
webihClass.iHiveIDClass iHClass = new iHiveIDClass();
string idsha1 = iHClass.GetiHiveID( loginID , typesize );
Response.Write("<script>location.href='"+HD_wwwServer+"login.aspx?HiveID="+loginID+"&iHiveID="+idsha1+"&typesize="+typesize+"'</script>");
}
else
{
Response.Write("<script>alert('用户名或者密码错误!禁止登录');</script>");
}
}
public string GetHiveDiskByLoginID(string LoginID)
{
SqlParameter[] Parameters = {new SqlParameter("@LoginID",SqlDbType.VarChar,50,"LoginID")};
Parameters[0].Value = LoginID;
DataBase DB = new DataBase();
string HiveDisk_Id = DB.ExecuteStore("JL_GetHiveIDByLoginID",Parameters);
return HiveDisk_Id;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -