using namespace System::Security;using namespace System::IO; ... String tempFolder;try { tempFolder = Path::GetTempPath();}catch(SecurityException* ex){ // probably means that you don't have the required permissions}catch(Exception* ex){ // handle all other exceptions}