Visual Basic script via API. How to add changes

Showing results for 
Show  only  | Search instead for 
Did you mean: 

Visual Basic script via API. How to add changes

L2 Linker



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] != "")
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);
solicitud.ContentType = "application/json";
solicitud.Method = HttpMethod.Get.Method;

string respuesta = "";

using (StreamReader streamin = new StreamReader(solicitud.GetResponse().GetResponseStream()))
respuesta = streamin.ReadToEnd();

catch { }




Could anyone help me?



Thanks in advance

Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

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!