Chapter 16 - Modifications/Corrections

In the source code for the Example at the bottom of page 418, change the code within the try..catch block to:

	  try {
		// session object
		v = objProps.GetProperty("Session");
		iObjSession = (ISessionObject)v.getDispatch();
			
		// get application value
		int i;
		i = iObjSession.getCodePage();
	
		v.putInt(i);

		// response object defined earlier
		iObjResponse.Write(v);	
		v.putString("<p>");
		iObjResponse.Write(v);			
		i = iObjSession.getLCID();
		v.putInt(i);
		iObjResponse.Write(v);
		}
	  catch(Exception e) {
		v.putString(e.getLocalizedMessage());
		iObjResponse.Write(v);			
		}

The example in the book shows the use of a string literal within an Response Write method. Literals need to be assigned to Variants, and then the Variant is written out. In addition, the example is missing a semi-colon at the end of this Write method statement.

The downloadable example contains the correct code.


I wanted to stress that components marked as "apartment-threaded" or "free-threaded" should not be used as Application-level or Session-Level scopes objects. You will receive errors if you use apartment-threaded objects in the Application object collections. Using apartment-threaded components as Session objects can lock the Session object down to a single thread, which will degrade performance of the ASP application. For both built-in objects, free-threaded components impact on performance as communication between the application and the component must occur through proxies.

Using both-threaded components can be used with the Application object, but sparingly. Their use with Session objects should be problem free, depending on the object, of course.


Microsoft has changed its Web site, and many of the links listed in the chapter have changed.

Replace all of the items in the Further Reading section with:

"Writing Microsoft Transaction Server Components in Java", at http://technet.microsoft.com/cdonline/content/complete/internet/server/transsrv/technote/mtsjava.htm.

"Developing MTS Components with Java", at http://msdn.microsoft.com/library/sdkdoc/mts20sp1/building_965d.htm.

"Java Class and Interface Definitions", at http://msdn.microsoft.com/library/sdkdoc/iisref/buil3foz.htm.

"Writing Microsoft Transaction Server Components in Java with Visual J++ 6.0" at http://msdn.microsoft.com/library/techart/msdn_mtsjava.htm.