使用ASP.net在Mac/iOS上打开数字应用程序

使用ASP.net在Mac/iOS上打开数字应用程序,asp.net,.net,ios,macos,Asp.net,.net,Ios,Macos,我们有一个内置于.net的网站。其中一个页面检测用户所在的操作系统,然后根据此操作系统显示xls/numbers图标 当用户单击图标时,Excel或数字将以空白页打开 这在基于微软的操作系统上运行良好,但在macs/iOS设备上却没有什么好运气 .cshtml文件中的代码调用控制器操作以打开任一应用程序。 这是我们正在使用的当前代码: File.cshtml // WINDOWS OS if (ViewBag.os == "windows") { <li><a href

我们有一个内置于.net的网站。其中一个页面检测用户所在的操作系统,然后根据此操作系统显示xls/numbers图标

当用户单击图标时,Excel或数字将以空白页打开

这在基于微软的操作系统上运行良好,但在macs/iOS设备上却没有什么好运气

.cshtml文件中的代码调用控制器操作以打开任一应用程序。 这是我们正在使用的当前代码:

File.cshtml

// WINDOWS OS
if (ViewBag.os == "windows") {
    <li><a href='@Url.Action("LoadFile", "Footprint", new { os = "windows" }, null)'><img src='@Url.Content("~/Content/img/excelicon.png")' width="55px" height="55px" /></a>  </li>                                   

// MAC OR IOS                                            
} else {
  if (ViewBag.os == "mac") {
    <li><a href='@Url.Action("LoadFile", "Footprint", new { os = "mac" }, null)'><img src='@Url.Content("~/Content/img/numbersicon.png")' width="55px" height="55px" /></a>  </li>

} else {
  <li><a href='@Url.Action("LoadFile", "Footprint", new { os = "ios" }, null)'><img src='@Url.Content("~/Content/img/numbersicon.png")' width="55px" height="55px" /></a>  </li>                                     
}
是否有一种方法可以使用Process.Start()打开Numbers.app? 任何其他想法都会很棒

提前感谢,,
Kat

不,在Mac OS或iOS上启动应用程序时,没有一种通用的方法可以不下载并打开与之相关的文件

事实上,您的Windows代码也有错误——当单击其中一个链接时,它将在服务器上打开Excel的实例,而不是在客户端计算机上

public ActionResult LoadFile(string os) {

  if (os == "windows") {
    System.Diagnostics.Process.Start("excel.exe", "/m");

  } else {    
    // Open Numbers.app
    ??
  }
  return Json(false, JsonRequestBehavior.AllowGet);
}