Asp.net

在 Web.Config 中模擬標籤

  • August 2, 2011

impersonate在 Asp.net 4.0 網站的 web.config 中使用標籤。

下面是我的 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"/>

我哪裡錯了?

identity部分在該system.web部分下,而不是在authentication

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

引用自:https://stackoverflow.com/questions/6918900