public void AddFileToSession(string controlId, string filename, HttpPostedFile fileUpload)
{
if(fileUpload == null)
throw new ArgumentNullException("fileUpload");
if(String.IsNullOrEmpty(controlId))
throw new ArgumentException("controlId cannot be empty", "controlId");
var currentContext = GetCurrentContext();
if(currentContext == null)
return;
var mode = currentContext.Session.Mode;
if(mode != SessionStateMode.InProc)
throw new InvalidOperationException("The AsyncFileUpload control only supports session state mode \"InProc\" when persisting files in session.");
currentContext.Session.Add(GetFullID(controlId), fileUpload);
}