20210918 单点登陆修改

This commit is contained in:
2021-09-18 13:26:51 +08:00
parent c0798d8358
commit 04b926db45
7 changed files with 40 additions and 58 deletions
+1 -33
View File
@@ -1,33 +1 @@
错误信息开始=====>
错误类型:FormatException
错误信息:输入的不是有效的 Base-64 字符串,因为它包含非 Base-64 字符、两个以上的填充字符,或者填充字符间包含非法字符。
错误堆栈:
在 System.Convert.FromBase64_Decode(Char* startInputPtr, Int32 inputLength, Byte* startDestPtr, Int32 destLength)
在 System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength)
在 System.Convert.FromBase64String(String s)
在 System.Security.Cryptography.RSA.FromXmlString(String xmlString)
在 FineUIPro.Web.Login.RSADecrypt(String privatekey, String content) 位置 D:\CWCEC\SGGL_CWCEC\SGGL\FineUIPro.Web\Login.aspx.cs:行号 161
在 FineUIPro.Web.Login.Page_Load(Object sender, EventArgs e) 位置 D:\CWCEC\SGGL_CWCEC\SGGL\FineUIPro.Web\Login.aspx.cs:行号 74
在 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
在 System.EventHandler.Invoke(Object sender, EventArgs e)
在 System.Web.UI.Control.OnLoad(EventArgs e)
在 System.Web.UI.Control.LoadRecursive()
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
出错时间:09/17/2021 14:54:20
出错文件:http://localhost:8118/Login.aspx?data=****&database=userName=sysgly&timespan=1256015312
IP地址:::1
出错时间:09/17/2021 14:54:20
错误信息开始=====>
错误类型:FormatException
错误信息:该字符串未被识别为有效的 DateTime。
错误堆栈:
在 System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
在 System.DateTime.Parse(String s)
在 BLL.Funs.GetNewDateTime(String time) 位置 D:\CWCEC\SGGL_CWCEC\SGGL\BLL\Common\Funs.cs:行号 554
出错时间:09/17/2021 14:56:12
出错时间:09/17/2021 14:56:12

+26 -15
View File
@@ -2,11 +2,8 @@
{
using BLL;
using System;
using System.Configuration;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Web;
using System.Web.Services;
public partial class Login : PageBase
@@ -70,28 +67,42 @@
string userdata = Request.Params["basedata"];
if (!string.IsNullOrEmpty(userdata))
{
string result = RSADecrypt(Const.OAPrivateKey_CWCEC, userdata); //经过RSA解密后获得的域登录名+时间戳
if (!string.IsNullOrEmpty(result))
try
{
var value = Funs.GetStrListByStr(result, '|');
if (value.Count > 1)
string result = RSADecrypt(Const.OAPrivateKey_CWCEC, userdata); //经过RSA解密后获得的域登录名+时间戳
if (!string.IsNullOrEmpty(result))
{
var userValues = Funs.GetStrListByStr(value[0], '=');
var timespan = Funs.GetStrListByStr(value[1], '=');
if (userValues.Count > 1 && timespan.Count > 1)
var value = Funs.GetStrListByStr(result, '&');
if (value.Count > 1)
{
DateTime? dateTimeS = Funs.IntToDateTime(Funs.GetNewIntOrZero(timespan[1]));
if (dateTimeS.HasValue && DateTime.Now.AddSeconds(-30) < dateTimeS)
var userValues = Funs.GetStrListByStr(value[0], '=');
var timespan = Funs.GetStrListByStr(value[1], '=');
if (userValues.Count > 1 && timespan.Count > 1 && timespan[1] != null)
{
if (LoginService.UserLogOn_OA(userValues[1], true, this.Page))
TimeSpan ts = DateTime.Now- new DateTime(1970, 1, 1, 0, 0, 0, 0);
//DateTime time = Funs.IntToDateTime(Convert.ToInt64(timespan[1]));
//if (DateTime.Now < time.AddSeconds(10)) //时间间隔小于10秒
if (Convert.ToInt64(ts.TotalMilliseconds) - Convert.ToInt64(timespan[1]) < 10000)
{
string url = getUrl();
Response.Redirect(url);
if (LoginService.UserLogOn_OA(userValues[1], true, this.Page))
{
string url = getUrl();
Response.Redirect(url);
}
}
else
{
Alert.ShowInTop("时间戳过期!", MessageBoxIcon.Warning);
}
}
}
}
}
catch (Exception ex)
{
//ErrLogInfo.WriteLog("OA单点登陆", ex);
//Alert.ShowInParent(ex.Message, MessageBoxIcon.Error);
}
}
}
}