This explanation assumes knowledge of ASP.NET and provides a basic RedBack example.

This example first connects to a uObject RBO (Employee) and then uses the RedBack Session ID when creating the second RBO on the page it redirects to. The idea is to reuse the Session ID from the first stateful object you create when you create all your other stateful objects (this can facilitate garbage college).

First of all, we create a RBO and then redirect to another page, passing the Session ID.

   private void Page_Load(object sender, System.EventArgs e)
   {
      string sessionID;
     // object for Employee
      REDPAGESLib.RedObject oEmp = new REDPAGESLib.RedObject();
      oEmp.Open2("rbexamples", "EXMOD:Employee", "", "", "");
      //preserve the session id so that we can associate other RBOs with this session
      sessionID = oEmp.sessionid;

      // Add session ID to cookies
      HttpCookie objCookie;
      objCookie = new HttpCookie("RB_SessionId",sessionID);
      Response.Cookies.Add(objCookie);

      // now redirect to example page
      Response.Redirect("uobjectex2.aspx");
  }

Now we'll either use the Session ID passed when creating the RBO or use the stored handle for the second RBO (if already created, i.e. not first time in).

The session ID is used when openning the CustomerMaint RBO. In this way we associate state with the current session.

	// Handle Stateful using sessionid and object handle in cookies
	foreach (string strVariable in Request.Cookies)
	{
		if (strVariable == "RB_SessionId")
		{
			RB_SessionId = Request.Cookies[strVariable].Value;
		}
		if (strVariable == "RB_" + ROName)
		{
			prevRBHandle = Request.Cookies[strVariable].Value;
			if (prevRBHandle != "")
			{
				RBHandle = prevRBHandle;
			}
		}
	}
	if ((Session[ROName] != null))
	{
		ro = (REDPAGESLib.RedObject) Session[ROName];
		try
		{
			ro.Open2(DatabaseName, RBHandle, Username, Password, RB_SessionId);
			IsOpen = true;
			if (Stateless == "N")
			{
				//Handle Stateful
				objCookie = new HttpCookie("RB_SessionId",ro.sessionid);
				Response.Cookies.Add(objCookie);
				objCookie = new HttpCookie("RB_" + ROName,ro.RBOHandle);
				Response.Cookies.Add(objCookie);
			}
		}
		catch (Exception ex)
		{
			//Set Message label with error message
			throw ex;
		}
	}

See the rbexamplesnetcsharp directory to review the page's entire source code.