InnerText异常 [英] InnerText exception
本文介绍了InnerText异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我在调试中的Visual Studio中观看"head"对象时,它写道:"InnerText =(InnerText)抛出了类型为system.Web.HttpException的异常."
为什么会发生?
When I watch "head" object in visual studio in debug, so it writes "InnerText = (InnerText) threw an exception of type system.Web.HttpException."
Why it happens?
Dim head As HtmlHead = New HtmlHead()
Dim title As HtmlTitle = New HtmlTitle()
head.Controls.Add(title)
谢谢
Thanks
推荐答案
您忘记在aspx页面中添加以下内容:
You forgot to add into your aspx page the following:
<head runat="server">
</head>
您的html标头必须为runat = server才能执行代码
Your html header must be runat=server in order to execute your code
实际上,这也会发生在其他任何属性上.
这是因为您正在检查的确具有定义但没有正确初始化的所有属性.
Actually this happens on any other property as well.
It is because you are checking a property which does have definition but not everything correctly initialized.
这篇关于InnerText异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文