我在Asp.net 4.0网站的web.config中使用了impersonate
标记。
以下是我的Web.Config代码:
<system.web>
<authentication mode="Windows">
<identity impersonate="true"
userName="Administrator"
password="LALLA$26526"/>
</authentication>
</system.web>
当我在Visual Studio中运行应用程序时,出现此错误:
Parser Error Message: Unrecognized element 'identity'.
来源错误:
Line 50: <system.web>
Line 51: <authentication mode="Windows">
Line 52: <identity impersonate="true"
Line 53: userName="Administrator"
Line 54: password="LALLA$26526"/>
我哪里错了?
答案 0 :(得分:71)
identity
部分位于system.web
部分下方,不在authentication
下:
<system.web>
<authentication mode="Windows"/>
<identity impersonate="true" userName="foo" password="bar"/>
</system.web>
答案 1 :(得分:9)
将identity
元素放在authentication
元素
答案 2 :(得分:8)
您将identity
节点作为authentication
节点的子节点。那就是问题所在。如上例所示,authentication
和identity
节点必须是system.web
节点的子节点