Usage of IRequiresSessionState Interface


IRequiresSessionState Interface is just marker to indicate that a specified custom HTTP Handler can read and write session state values. Since, it is a marker interace there won't be any methods to be implemented.

Syntax:

public class MyHandler : IHttpHandler,IRequiresSessionState
{
processRequest(HttpContext context)
{
//Now,Session Can be accessed.
context.Session["id"]="test";
}
}

Similar way,we can use IReadOnlySessionState marker Interface to have read only permission on Session data.Without specifying above markers, Session will be null in our Custom HTTP Handler.
Next Recommended Reading Interface