How to get data.COOKIES Key (cookie name)

How to get the cookie name from the data.COOKIES dictionary?
The getKey method not working for me either.

Hello @KingDaniels,
Can this help you?
Cookies :

Capture

Code :

// Put this after the request you want to capture cookies names.
Console.Clear(); //Optional
var KingDaniels = data.COOKIES.Keys; // Get All Cookies Keys
int number = 0; //Optional
foreach (string name in KingDaniels)
{
  number++; // Optional
  Console.WriteLine("KeyName "+ number + ":"+ " " + name);
 
}

Console :
Capture

I think there is even faster than that but since its in any case if it can help you out.

I get this:

CompilationErrorException
(21,48): error CS1929: ‘Dictionary.KeyCollection’ does not contain a definition for ‘AsString’ and the best extension method overload ‘BoolExtensions.AsString(bool)’ requires a receiver of type ‘bool’

Basically seems data.COOKIES has not Keys parameter

It’s a dictionary he has so didn’t you make a mistake when you imported the code?
Capture
See it works perfectly

Another method if you want to capture a specific key you can use indexes like this :

string test = data.COOKIES.Keys.ElementAt<string>(cookiesindexes);

again another method :

var KingDaniels = data.COOKIES.Keys.ToArray();
BLOCK:Parse
  input = $"<KingDaniels[5]>"
  MODE:LR
  => VAR @parseOutput
ENDBLOCK

Console.WriteLine(parseOutput);

Capture

2 Likes

This worked, omg really really thanks. I’ve trying to find this for so many hours omg… Thanks

1 Like