In a .NET 2.0 C# application I use the following code to detect the operating system platform:
string os_platform = System.Environment.OSVersion.Platform.ToS
Try this:
Environment.Is64BitOperatingSystem Environment.Is64BitProcess