This creates a session singleton. In this example I am persisting a stringbuilder however you generally want a wrapper object in the case where you have two items that need persisting for that page. To generate the unique strings you can reflect the page name. Using this shows that you should rarely/never use Session.add ( within the same page context. ) Between pages will require some more error handling but will work as well. You can also use a per request session in some cases but that is beyond this sample.
private StringBuilder xml
{
get
{
return (HttpContext.Current.Session["UNIQUESTRINGHERE"] ??
(HttpContext.Current.Session["UNIQUESTRINGHERE"] =
new StringBuilder())) as StringBuilder;
}
}