Click or drag to resize

PdfLiteSessionProvider Class

Defines the contract that RAD PDF implements to manage sessions for Lite Document instances.
Inheritance Hierarchy

Namespace:  RadPdf.Lite
Assembly:  RadPdf (in RadPdf.dll) Version: (
public abstract class PdfLiteSessionProvider

The PdfLiteSessionProvider type exposes the following members.

Public methodPdfLiteSessionProvider
Creates a new instance of the PdfLiteSessionProvider class.
Public methodAddSession
Adds a new PdfLiteSession to the provider.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGenerateKey
Gets a string which contains a randomly generated key using RNGCryptoServiceProvider.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetSession
Gets a PdfLiteSession from the provider associated with a given key.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
The following example overrides the default PdfIntegrationProvider to create a custom Integration Provider for the web application. This custom provider assigns a custom LiteSessionProvider which uses a simple dictionary.
using System;
using System.Web;

using RadPdf.Integration;

public class CustomPdfIntegrationProvider : PdfIntegrationProvider
    public CustomPdfIntegrationProvider() : base()
        this.LiteSessionProvider = new CustomPdfLiteSessionProvider();
using System;
using System.Collections.Concurrent;
using System.Web;

using RadPdf.Lite;

public class CustomPdfLiteSessionProvider : PdfLiteSessionProvider
    // This example uses an in memory dictionary, which won't have 
    // persistent storage, but a database or other key /value store
    // can easily be substituted.
    private readonly ConcurrentDictionary<string, byte[]> _dict;

    public CustomPdfLiteSessionProvider() : base()
        _dict = new ConcurrentDictionary<string, byte[]>();

    public override string AddSession(PdfLiteSession session)
        string key = GenerateKey();

        _dict[key] = session.Serialize();

        return key;

    public override PdfLiteSession GetSession(string key)
        byte[] data = _dict[key];

        if (null == data)
            return null;

        return PdfLiteSession.Deserialize(data);
The following web.config file registers the above custom Integration Provider. This example assumes that CustomPdfIntegrationProvider is in the directory App_Code of your ASP.NET web application.
<?xml version="1.0"?>
    <add key="RadPdfLicenseKey" value="DEMO"/>
    <add key="RadPdfIntegrationProvider" value="CustomPdfIntegrationProvider,App_Code"/>
      <add path="RadPdf.axd" verb="GET,POST" type="RadPdf.Web.HttpHandler.PdfHttpHandler"/>
    The system.webServer element is for use with IIS 7 (and later) when Managed Pipeline Mode is set to "Integrated".
    It will be ignored in other versions of IIS.
    <validation validateIntegratedModeConfiguration="false"/>
      <add path="RadPdf.axd" verb="GET,POST" name="PdfHttpHandler" preCondition="integratedMode" type="RadPdf.Web.HttpHandler.PdfHttpHandler"/>
See Also