public void GeneratePid(ClientCredential client = null, bool forceNewPid = true) { if (string.IsNullOrEmpty(Pid)) { Pid = Guid.NewGuid().ToString().Replace(STR_Dash, string.Empty); } if (client != null) { if (string.IsNullOrEmpty(client.Pid) || forceNewPid) { client.Pid = Pid.EncryptStringAES(ServerPassword); } } }
public bool Validate(ClientCredential client, bool forceDecrypt = true) { if (client != null) { if (!string.IsNullOrEmpty(client.Pid)) { try { if (forceDecrypt || string.IsNullOrEmpty(DPid)) { DPid = client.Pid.DecryptStringAES(ServerPassword); } } catch { return false; } } client.IsValid = IsValidRequest; } return IsValidRequest; }
private void InitializeClientCredential() { Session[STR_Time] = DateTime.UtcNow; string xml = HttpUtility.UrlDecode(Cookie(KeyClientCache)); if (!string.IsNullOrEmpty(xml)) { clientCredential = xml.FromXml<ClientCredential>(); } else { clientCredential = new ClientCredential(); } }