本文介绍了我在运行我的页面时遇到了错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 嗨朋友当我要运行我的页面时,我得到了 错误:无法将System.String类型的对象强制转换为System。字节[]'。像这样,请你给我一个帮助请 这里的代码 Dim TableContainer作为新的DataTable 尝试 Dim getvalues As New Select_Property() Dim ReturnVar As Integer = 1 BusinessLayer = New BLL () values.FLAG =EMAIL getsetvalues.order_No = MessageID TableContainer = BusinessLayer.GenerateData(values,func_amc(sess_id),strUserCode,strEqyPage,) 如果TableContainer.Rows.Count> 0然后 Dim attachment As String =attachment; filename = _received.eml Response.ContentType =application / windows live mail 2012 Response.AddHeader(Content-Disposition,附件) Response.ClearContent() Response.Charset = If(Not TableContainer.Rows(0).Item(0)是DBNull.Value)然后 MailBLOB = CType(TableContainer.Rows(0).Item(0) ,Byte()) 结束如果 Response.OutputStream.Read(MailBLOB,0,MailBLOB.Length) TableContainer = Nothing Else ClientScript.RegisterStartupScript(Me.GetType(),Message,< script> alert('No E-mail Attached');< / script> ) 结束如果 '结束如果 Catch ex1 As Threading.ThreadAbortException 抓住e作为例外 最后 BusinessLayer.Dispose() 结束尝试 Regrds, Velsamy A 解决方案 您好, 如果您将代码发布到卡住的地方,那将是件好事。 几乎没有类似的主题: 如何在asp.net中给出一个消息警告框? [ ^ ] 无法投射'System'类型的对象.String'键入'System.Byte []'。 [ ^ ] 无法将'System.String'类型的对象强制转换为'System.Byte []'。例外 [ ^ ] 无法将'System.String'类型的对象强制转换为'System.Byte []' [ ^ ] http://stackoverflow.com/questions/19358883/unable-to-cast-object-of-type-system-byte-to-type-system-string [ ^ ] http://stackoverflow.com/questions/17769137/unable-to-cast-object-of-type -system-byte-to-type-system-string [ ^ ] Hi Friends While i m going to run my page i am getting theError : Unable to cast object of type 'System.String' to type 'System.Byte[]'. like this, will you please give me a help pleasecode hereDim TableContainer As New DataTable Try Dim getvalues As New Select_Property() Dim ReturnVar As Integer = 1 BusinessLayer = New BLL() values.FLAG = "EMAIL" getsetvalues.order_No = MessageIDTableContainer = BusinessLayer.GenerateData(values, func_amc(sess_id), strUserCode, strEqyPage, "") If TableContainer.Rows.Count > 0 Then Dim attachment As String = "attachment; filename= _received.eml" Response.ContentType = "application/windows live mail 2012" Response.AddHeader("Content-Disposition", attachment) Response.ClearContent() Response.Charset = "" If (Not TableContainer.Rows(0).Item(0) Is DBNull.Value) Then MailBLOB = CType(TableContainer.Rows(0).Item(0), Byte()) End IfResponse.OutputStream.Read(MailBLOB, 0, MailBLOB.Length) TableContainer = NothingElse ClientScript.RegisterStartupScript(Me.GetType(), "Message", "<script> alert('No E-mail Attached');</script>") End If 'End If Catch ex1 As Threading.ThreadAbortException Catch e As Exception Finally BusinessLayer.Dispose() End TryRegrds ,Velsamy A 解决方案 这篇关于我在运行我的页面时遇到了错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-18 20:24