我在我的网站上使用impersonate标签.在Asp中配置.NET4.0网站.

Below is my Web.Config code:

<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"/>

我哪里做错了?

推荐答案

identity部分属于system.web部分,而不是authentication部分:

<system.web>
  <authentication mode="Windows"/>
  <identity impersonate="true" userName="foo" password="bar"/>
</system.web>

Asp.net相关问答推荐

ReportViewer 控件 - 高度问题

jquery 1.9.0 和 modernizr 无法使用 ASP.NET Web 优化框架进行缩小

返回 HttpResponseMessage 时的 WebAPI Gzip

如何在 ASP.NET 中使用时区?

HttpWebRequest 未通过凭据

新的 ASP.NET MVC 5 应用程序如何知道如何创建数据库以及帐户控制器如何访问数据库?

stream.CopyTo - 文件为空.网

在 asp.net 中调整图像大小而不会丢失图像质量

如何在asp.net mvc的html.actionlink中调用javascript函数?

如何以编程方式将标签的前景色设置为其默认值?

您使用哪个 .NET Memcached 客户端,EnyimMemcached 与 BeITMemcached?

InvalidOperationException:无法为角色创建 DbSet,因为此类型未包含在上下文模型中

如何使div按钮提交其所在的表单?

删除 HTML 或 ASPX 扩展

如何使用 jquery 设置单选按钮 Select 的值

将Bundle 包添加到现有的 ASP.NET Webforms 解决方案

System.Threading.Tasks - 限制并发任务的数量

中继器中的中继器

RegisterStartupScript 不适用于 ScriptManager、Updatepanel.这是为什么?

无法使用 ip:port 访问 WEB API,但可以在 VS 调试模式下使用 localhost:port