I spent the day searching for a good solution to detecting plugins such as Shockwave, Flash, Quicktime, etc. The final solution was using http://www.pinlady.net/PluginDetect/. It was as easy as generating the javascript file, adding it to my solution, and adding the following script to my page. <![CDATA[ PluginDetect.getVersion(‘.’); var v = PluginDetect.getVersion(‘Flash’); var isInstalled = (PluginDetect.isMinVersion(‘Flash’, ‘0’) >= 0 ? true : false); if (isInstalled) document.write(“Adobe Flash (” + v + “) is installed.”) else document.write(“Adobe Flash is disabled. Get Adobe Flash.”) ]]>
Category: .NET
Run command as if from DOS prompt
The following code snippet can be used to run a command as if you are opening a DOS prompt and typing it in.
public static string MyDOSMethod()
{
ProcessStartInfo si = new ProcessStartInfo("cmd.exe");
si.RedirectStandardInput = true;
si.RedirectStandardOutput = true;
si.UseShellExecute = false;
Process p = Process.Start(si);
p.StandardInput.WriteLine(@"cd \windows\system32");
p.StandardInput.WriteLine("exit");
try
{
return p.StandardOutput.ReadToEnd();
}
catch (Exception e)
{
return e.Message;
}
}