Unanswered question

Clear cookie ARRAffinity

I have a project with 1 server ARR and 2 IIS server.
The project contains 2 transactions, each use a diffrent cookie ARRAfinity to commit database informations. I want to clear this cookie after each used.
I have tried to write javascript, but the cookie ARRAffinity is not "cleaned". This code is correct for a simple cookie like an authentication cookie;

function ClearCookie( cookieName,cookieValue,cookiePath,serverName)
{
//Définition d'une date dépassée
var expires_date = new Date(0);
var cookie = cookieName+"="+cookieValue+"; expires=" + expires_date.toGMTString() +"; "+cookiePath;

logger.debug(cookie);

//
context.currentVU.setCookieForServer(serverName,cookie);

}

var ArrCookieName="ARRAffinity";
var myVar = context.variableManager.getValue("Ext_ARRAffinity");
logger.debug("ArrCookieName="+ArrCookieName);
if (myVar==null) {
context.fail("Variable 'Ext_ARRAffinity' not found");
}

logger.debug("myVar="+myVar);

var serverARR = context.variableManager.getValue("ServerArr");
ClearCookie("ARRAffinity",myVar,"Path=/app;Domain="+serverARR,serverARR);

The name of the server is the NeoLoad name of the server, not the physical one.

Alain T.
Alain T.

Alain T.

Level
0
14 / 100
points

Answers

Nouredine A.
Nouredine A.

Nouredine A.

Level
4
5000 / 5000
points
Team

Is it the only cookie that is used because you could use the Javascript method "clearCookies()" to clear the cookies between the two transactions.

Regarding your code it's difficult to tell what is wrong. But usually if NeoLoad does not clear your cookie it might be due to the cookie parameters that are not matching.

Alain T.
Alain T.

Alain T.

Level
0
14 / 100
points

No there are others cookies... I try to use "clearCookies()", but I don't know which is the impact of this method in the project.
Example (look at the join file) :
1- Connection with an Basic authentication and a specific cookie
2- Some actions
Loop
3- First Transaction with database commit and cookie ARRAffinity
4- Some actions
5- Second Transaction with database commit and cookie ARRAffinity
end loop
6- End actions

If I use clearCookie method after third and fiveth steps, the authentication cookie is clear too, I must make another authentication cookie.
Do you know if there are others actions to do ?
Can you explain me how this method work with multiple Virtual User ?

I'm french, if you speak frenc I prefer ;)