- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
Enhanced Security Measures in Place: To ensure a safer experience, we’ve implemented additional, temporary security measures for all users.
08-16-2022 11:20 PM - edited 08-16-2022 11:25 PM
Hello,
I have configured a script in Visual Basic to disconnect all the GP VPN users logged but now I need to make an exception in order to not disconnect only one user.
I don't know how to code this exception.
After reading all the users logged in the firewall I make the following to disconnect them:
j = 0;
while (user1[j] != null)
{
if (user1[j] != "")
{
try
{
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
System.Net.WebRequest solicitud = System.Net.WebRequest.Create("https://" + ip_pa1 + "/api/?type=op&cmd=<request><global-protect-gateway><client-logout><gateway>" + pa_gw + "</gateway><user>" + user1[j] + "</user><reason>force-logout</reason><computer>" + computer1[j] + "</computer></client-logout></global-protect-gateway></request>&key=" + api_key);
if (domain1[j] != "")
{
solicitud = System.Net.WebRequest.Create("https://" + ip_pa1 + "/api/?type=op&cmd=<request><global-protect-gateway><client-logout><gateway>" + pa_gw + "</gateway><domain>" + domain1[j] + "</domain><user>" + user1[j] + "</user><reason>force-logout</reason><computer>" + computer1[j] + "</computer></client-logout></global-protect-gateway></request>&key=" + api_key);
}
Console.WriteLine(solicitud);
j++;
solicitud.ContentType = "application/json";
solicitud.Method = HttpMethod.Get.Method;
string respuesta = "";
using (StreamReader streamin = new StreamReader(solicitud.GetResponse().GetResponseStream()))
{
respuesta = streamin.ReadToEnd();
}
}
catch { }
System.Threading.Thread.Sleep(500);
}
}
Could anyone help me?
Thanks in advance
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!