Passa al contenuto principale

Class CookieHelper

Namespace: TecnoPack.WebServer
Assembly: CO0002_Templ_FlowpackHMI_V00_26_M.dll

Provides helper methods to work with cookies in HTTP requests.

public static class CookieHelper

Inheritance

object ← CookieHelper

Methods

ParseCookies(string)

Parses the cookies from the given HTTP request and retrieves them as a dictionary.

public static Dictionary<string, string> ParseCookies(string cookieHeader)

Parameters

cookieHeader string

The raw cookie header from the HTTP request, typically found in Request.Headers["Cookie"].

Returns

Dictionary<string, string>

A dictionary containing the cookie keys and their corresponding values.

Remarks

The method will split the cookie header by semicolons and parse each cookie as a key-value pair, returning a dictionary with all cookies found in the header.

Exceptions

ArgumentNullException

Thrown when cookieHeader is null or empty.