Open a html file using default web browser

前端 未结 4 873
执笔经年
执笔经年 2021-01-04 00:57

I\'m using this to get the path and executable of default web browser:

public static string DefaultWebBrowser
        {
            get
            {

               


        
4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-04 01:14

    For .Net Core you need to call (suggested in .Net Core 2.0 Process.Start throws "The specified executable is not a valid application for this OS platform")

     var proc = Process.Start(@"cmd.exe ", @"/c " + pathToHtmlFile); 
    

    When I tried Process.Start(pathToHtmlFile);, I've got System.ComponentModel.Win32Exception: The specified executable is not a valid application for this OS platform.

提交回复
热议问题