<authentication mode="Forms">
<forms name="ASPAuth"
path="/Admin"
timeout="20"
requireSSL="false"
slidingExpiration="true" />
</authentication>
在我的開發系統上,我在web.config中有上述內容。這工作正常,如果我使用VS Web服務器。但是,當我使用虛擬目錄在我的IIS7上託管相同的網站時,它不會。表單身份驗證cookie的相對路徑
VS網址看起來像:http://localhost:xxxx/
IIS URL看起來像:http://MachineName/MyApp/。
通過IIS訪問網站時,IsAuthenticated始終爲false。我發現這是因爲cookie被分配到http://MachineName/Admin/而不是http://MachineName/MyApp/Admin。
我如何讓「Admin」成爲相對路徑?我試過path =「〜/ Admin」,但那不起作用。
謝謝!