没有注册类别 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: 没有注册类别 请大家帮我分析一下,这个问题可能是什么原因。

解决方案 »

  1.   

    代码如下:
    private void ProduceMhtFile(string URL,string FileName)
    {
    CDO.Message msg=new CDO.MessageClass();
    // msg.CreateMHTMLBody(URL,CDO.CdoMHTMLFlags.cdoSuppressAll,"","");
    msg.CreateMHTMLBody(URL,CDO.CdoMHTMLFlags.cdoSuppressAll,"","");
    ADODB.Stream sw=msg.GetStream();
    string urlPath = HttpContext.Current.Request.ApplicationPath + "/Temp/";  //虚拟目录
    string physicPath = HttpContext.Current.Server.MapPath(urlPath); //物理地址
    string strFileName=Guid.NewGuid()+".mht";
    sw.SaveToFile(physicPath+strFileName,ADODB.SaveOptionsEnum.adSaveCreateOverWrite);
    HttpContext.Current.Response.Clear();
    HttpContext.Current.Response.ContentType = "mht";
    HttpContext.Current.Response.WriteFile(urlPath+strFileName);
    HttpContext.Current.Response.AppendHeader("Content-Disposition","attachment;filename="+HttpUtility.UrlEncode(FileName)+"");
    HttpContext.Current.Response.Charset ="GB2312";
    HttpContext.Current.Response.ContentEncoding =System.Text.Encoding.GetEncoding("GB2312");
    HttpContext.Current.Response.ContentType ="text/mhtml";//image/JPEG;text/HTML;image/GIF;vnd.ms-excel/msword
    HttpContext.Current.Response.Flush();
    System.IO.File.Delete(physicPath+strFileName);//删除临时文件
    HttpContext.Current.Response.End(); }
      

  2.   

    http://www.codeproject.com/vb/net/MhtBuilder.asp.Convert HTML to MHTML using ASP.NEThttp://www.codeproject.com/aspnet/aspnethtml2mht.asp
      

  3.   

    我试过把 c:\windows\system32\cdosys.dll 导入到工程然后调用该dll里的CDO类,不是调用 Interop.CDO.dll,可以成功
    楼主可以试试