1.在IE浏览器上调用客户端程序
var WSHShell = new ActiveXObject("WScript.Shell"); var path = ""; if (GetOSVersion() == "64") path = WSHShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\PzdnSoft\Path"); else path = WSHShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\PzdnSoft\Path"); WSHShell.exec(path + "\Some.exe " + paramters);
关于如何获取OS的信息:
http://www.cnblogs.com/duanguyuan/p/3534470.html
2. net4.0 的 dynamic Sample
如果需要返回一个JSON格式的,可以直接使用动态类型语法,简单地构造,避免为了迎合编译而带来的一系列代码:
var mainData= new List<dynamic>(); for (int i = 0; i < list.Count(); i++) { mainData.Add(new { OrderId= list[i]; }); } return Json(new { mainData });