You'll have to do it with unmanaged code.
You need a new class file named Memory.cs (assuming C#)
Code:
using System;
using System.Runtime.InteropServices;
namespace Memory
{
public class Memory
{
private struct MEMORYSTATUS
{
public int dwLength;
public int ddwMemoryLoad;
public int dwTotalPhys;
public int dwAvailPhys;
public int dwTotalPageFile;
public int dwAvailPageFile;
public int dwTotalVirtual;
public int dwAvailVirtual;
}
[DllImport ("kernel32.dll")]
private static extern void GlobalMemoryStatus(ref MEMORYSTATUS lpMem);
private MEMORYSTATUS memStat;
public int GetTotalMemory()
{
GlobalMemoryStatus(ref memStat);
return memStat.dwTotalPhys / 1024;
}
public Memory()
{
}
}
}
and the Page_Load or other Event
Code:
private void Page_Load(object sender, System.EventArgs e)
{
Memory mem = new Memory();
Label1.Text = "Total Memory = " + mem.GetTotalMemory().ToString() + " KB";
}