I tried to save a page to MHT file programmatically using the following code:
CDO.Message msg = new CDO.MessageClass();
ADODB.Stream srm = null;
msg.MimeFormatted = true;
msg.CreateMHTMLBody("Test.aspx", CDO.CdoMHTMLFlags.cdoSuppressNone, "", "");
srm = msg.GetStream();
srm.SaveToFile(@"F:\Sample.mht", ADODB.SaveOptionsEnum.adSaveCreateNotExist);
msg = null;
srm.Close();
It is failed on msg.CreateMHTMLBody("Test.aspx", CDO.CdoMHTMLFlags.cdoSuppressNone, "", ""); with message :
Error: Sys.WebForms.PageRequestManagerServerErrorException: The specified protocol is unknown.
CDO.Message msg = new CDO.MessageClass();
ADODB.Stream srm = null;
msg.MimeFormatted = true;
msg.CreateMHTMLBody("Test.aspx", CDO.CdoMHTMLFlags.cdoSuppressNone, "", "");
srm = msg.GetStream();
srm.SaveToFile(@"F:\Sample.mht", ADODB.SaveOptionsEnum.adSaveCreateNotExist);
msg = null;
srm.Close();
It is failed on msg.CreateMHTMLBody("Test.aspx", CDO.CdoMHTMLFlags.cdoSuppressNone, "", ""); with message :
Error: Sys.WebForms.PageRequestManagerServerErrorException: The specified protocol is unknown.