Esempio n. 1
0
		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);
				}
			}
		}
Esempio n. 2
0
		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;
		}
Esempio n. 3
0
		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();
			}
		}