html网页中”未将对象引用设置到对象的实例“表示什么?
2013-09-02 18:21
435 查看
在做html页面转为mht页面时,根据网上资料实现了,后来不知道什么时候再使用时就报错了,经过跟踪和捕捉找到提示“未将对象引用设置到对象的实例”,我也检查了要转换的html没有问题,权限和路径也没有问题,不知道还有什么原因会导致这个结果,请各位解救,谢谢!
public bool GenerateMhtFileExt(string Url, string FileNameWithDir)
{
//生成mht文件...Begin
bool bReturnValue = false;
StreamWriter sw=null;
CDO.Message message = new CDO.MessageClass();
ADODB.Stream stream = null;
message.MimeFormatted =true;
message .CreateMHTMLBody(Url,CDO.CdoMHTMLFlags.cdoSuppressNone,"",""); stream = message.GetStream();
string sAbsPath = HttpContext.Current.Server.MapPath(FileNameWithDir);
stream.Charset = "GB2312";
//经过跟踪发现在保存时出错,提示“未将对象引用设置到对象的实例”
stream.SaveToFile(sAbsPath, ADODB.SaveOptionsEnum.adSaveCreateOverWrite);
PublicFunction.ReleaseComObject(message );//释放资源
PublicFunction.ReleaseComObject(stream);//释放资源
bReturnValue = true;
return bReturnValue;
//生成mht文件...End
}
public bool GenerateMhtFileExt(string Url, string FileNameWithDir)
{
//生成mht文件...Begin
bool bReturnValue = false;
StreamWriter sw=null;
CDO.Message message = new CDO.MessageClass();
ADODB.Stream stream = null;
message.MimeFormatted =true;
message .CreateMHTMLBody(Url,CDO.CdoMHTMLFlags.cdoSuppressNone,"",""); stream = message.GetStream();
string sAbsPath = HttpContext.Current.Server.MapPath(FileNameWithDir);
stream.Charset = "GB2312";
//经过跟踪发现在保存时出错,提示“未将对象引用设置到对象的实例”
stream.SaveToFile(sAbsPath, ADODB.SaveOptionsEnum.adSaveCreateOverWrite);
PublicFunction.ReleaseComObject(message );//释放资源
PublicFunction.ReleaseComObject(stream);//释放资源
bReturnValue = true;
return bReturnValue;
//生成mht文件...End
}
相关文章推荐
- "未将对象引用设置到对象的实例"是什么原因?
- 未将对象引用设置到对象的实例都是一些什么错啊
- 在发布网站后,出现“未将对象引用设置到对象的实例”的错误时,是什么原因?
- asp.net报错:“System.NullReferenceException: 未将对象引用设置到对象的实例”
- 周末浅说--未将对象引用设置到对象的实例(System.NullReferenceException)
- 常见问题小记(未将对象引用设置到对象的实例。)
- WebService客户端引用 服务器无法处理请求。 ---> 未将对象引用设置到对象的实例
- 加载设计器错误——未将对象引用设置到对象的实例 之解决方法
- 未将对象引用设置到对象的实例--可能出现的问题总结
- 动态传值用户控件,未将对象引用设置到对象的实例
- c#出错:System.NullReferenceException: 未将对象引用设置到对象的实例
- 未将对象引用设置到对象的实例--可能出现的问题总结
- 服务器无法处理请求。 ---> 未将对象引用设置到对象的实例
- asp.net oracle 无法加载 DLL (oci.dll) 无法加载 DLL (oci.dll) 未将对象引用设置到对象的实例,解决方法
- 未将对象引用设置到对象的实例
- silverlight 报 System.NullReferenceException 未将对象引用设置到对象的实例。
- 未将对象引用设置到对象的实例--可能出现的问题总结
- 未将对象引用设置到对象的实例异常的原因,
- 未将对象引用设置到对象的实例--可能出现的问题总结
- 未将对象引用设置到对象的实例--可能出现的问题总结