Show / Hide Table of Contents

# Class SessionEventArgs

Holds info related to a single proxy session (single request/response sequence) A proxy session is bounded to a single connection from client A proxy session ends when client terminates connection to proxy or when server terminates connection from proxy

##### Inheritance

Object
EventArgs
SessionEventArgsBase
SessionEventArgs

##### Implements

IDisposable

##### Inherited Members

SessionEventArgsBase.BufferSize
SessionEventArgsBase.ExceptionFunc
SessionEventArgsBase.Id
SessionEventArgsBase.IsHttps
SessionEventArgsBase.ClientEndPoint
SessionEventArgsBase.WebSession
SessionEventArgsBase.CustomUpStreamProxyUsed
SessionEventArgsBase.LocalEndPoint
SessionEventArgsBase.IsTransparent
SessionEventArgsBase.Exception
SessionEventArgsBase.DataSent
SessionEventArgsBase.DataReceived
SessionEventArgsBase.TerminateSession()
EventArgs.Empty
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()

###### Namespace: Titanium.Web.Proxy.EventArguments

###### Assembly: Titanium.Web.Proxy.dll

##### Syntax

    public class SessionEventArgs : SessionEventArgsBase, IDisposable

### Constructors

#### SessionEventArgs(Int32, ProxyEndPoint, Request, CancellationTokenSource, ExceptionHandler)

##### Declaration

    protected SessionEventArgs(int bufferSize, ProxyEndPoint endPoint, Request request, CancellationTokenSource cancellationTokenSource, ExceptionHandler exceptionFunc)

##### Parameters

Type | Name | Description
--- | --- | ---
Int32 | bufferSize |
ProxyEndPoint | endPoint |
Request | request |
CancellationTokenSource | cancellationTokenSource |
ExceptionHandler | exceptionFunc |

### Properties

#### ReRequest

Should we send the request again

##### Declaration

    public bool ReRequest { get; set; }

##### Property Value

Type | Description
--- | ---
Boolean |

### Methods

#### Dispose()

implement any cleanup here

##### Declaration

    public override void Dispose()

##### Overrides

SessionEventArgsBase.Dispose()

#### GenericResponse(Byte[], HttpStatusCode, Dictionary<String, HttpHeader>)

Before request is made to server Respond with the specified byte[] to client and the specified status and ignore the request

##### Declaration

    public void GenericResponse(byte[] result, HttpStatusCode status, Dictionary<string, HttpHeader> headers)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Byte[] | result |
HttpStatusCode | status |
Dictionary<String, HttpHeader> | headers |

#### GenericResponse(String, HttpStatusCode, Dictionary<String, HttpHeader>)

Before request is made to server Respond with the specified HTML string to client and the specified status and ignore the request

##### Declaration

    public void GenericResponse(string html, HttpStatusCode status, Dictionary<string, HttpHeader> headers = null)

##### Parameters

Type | Name | Description
--- | --- | ---
String | html |
HttpStatusCode | status |
Dictionary<String, HttpHeader> | headers |

#### GetRequestBody(CancellationToken)

Gets the request body as bytes

##### Declaration

    public Task<byte[]> GetRequestBody(CancellationToken cancellationToken = default(CancellationToken))

##### Parameters

Type | Name | Description
--- | --- | ---
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
Task<System.Byte[]> |

#### GetRequestBodyAsString(CancellationToken)

Gets the request body as string

##### Declaration

    public Task<string> GetRequestBodyAsString(CancellationToken cancellationToken = default(CancellationToken))

##### Parameters

Type | Name | Description
--- | --- | ---
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
Task<String> |

#### GetResponseBody(CancellationToken)

Gets the response body as byte array

##### Declaration

    public Task<byte[]> GetResponseBody(CancellationToken cancellationToken = default(CancellationToken))

##### Parameters

Type | Name | Description
--- | --- | ---
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
Task<System.Byte[]> |

#### GetResponseBodyAsString(CancellationToken)

Gets the response body as string

##### Declaration

    public Task<string> GetResponseBodyAsString(CancellationToken cancellationToken = default(CancellationToken))

##### Parameters

Type | Name | Description
--- | --- | ---
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
Task<String> |

#### Ok(Byte[], Dictionary<String, HttpHeader>)

Before request is made to server Respond with the specified byte[] to client and ignore the request

##### Declaration

    public void Ok(byte[] result, Dictionary<string, HttpHeader> headers = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Byte[] | result |
Dictionary<String, HttpHeader> | headers |

#### Ok(String, Dictionary<String, HttpHeader>)

Before request is made to server Respond with the specified HTML string to client and ignore the request

##### Declaration

    public void Ok(string html, Dictionary<string, HttpHeader> headers = null)

##### Parameters

Type | Name | Description
--- | --- | ---
String | html |
Dictionary<String, HttpHeader> | headers |

#### Redirect(String)

Redirect to URL.

##### Declaration

    public void Redirect(string url)

##### Parameters

Type | Name | Description
--- | --- | ---
String | url |

#### Respond(Response)

##### Declaration

    public void Respond(Response response)

##### Parameters

Type | Name | Description
--- | --- | ---
Response | response |

#### SetRequestBody(Byte[])

Sets the request body

##### Declaration

    public void SetRequestBody(byte[] body)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Byte[] | body |

#### SetRequestBodyString(String)

Sets the body with the specified string

##### Declaration

    public void SetRequestBodyString(string body)

##### Parameters

Type | Name | Description
--- | --- | ---
String | body |

#### SetResponseBody(Byte[])

Set the response body bytes

##### Declaration

    public void SetResponseBody(byte[] body)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Byte[] | body |

#### SetResponseBodyString(String)

Replace the response body with the specified string

##### Declaration

    public void SetResponseBodyString(string body)

##### Parameters

Type | Name | Description
--- | --- | ---
String | body |

#### TerminateServerConnection()

##### Declaration

    public void TerminateServerConnection()

### Events

#### MultipartRequestPartSent

Occurs when multipart request part sent.

##### Declaration

    public event EventHandler<MultipartRequestPartSentEventArgs> MultipartRequestPartSent

##### Event Type

Type | Description
--- | ---
EventHandler<MultipartRequestPartSentEventArgs> |

### Implements

System.IDisposable