我想從根應用程序共享表單身份驗證到在虛擬目錄中運行的子應用程序。我在子網站中遇到了身份驗證問題。跨虛擬目錄的表單身份驗證
在父應用程序中,一切都按預期工作。
我有以下設置:
父應用:
- URL:
http://localhost:1336/
<forms loginUrl="~/account/sign-in" protection="All" timeout="30" name=".MYAPPLICATION" path="/" requireSSL="false" slidingExpiration="true" cookieless="UseDeviceProfile" enableCrossAppRedirects="true" defaultUrl="/" />
虛擬目錄:
- URL:
http://localhost:1336/subsite
<forms loginUrl="/account/sign-in" protection="All" timeout="30" name=".MYAPPLICATION" path="/" requireSSL="false" slidingExpiration="true" cookieless="UseDeviceProfile" enableCrossAppRedirects="true" defaultUrl="/" />
當我嘗試一個http://localhost:1336/subsite
我得到以下流程:
- GET爲
http://localhost:1336/subsite
- > 302 /帳號/點登錄in?ReturnUrl =%2fsubsite (看起來不錯) - Ent呃用戶/密碼,
- POST到
http://localhost:1336/account/sign-in?ReturnUrl=%2fsubsite
- > 302 /子網站(偉大的權威性看起來像它的成功) - GET爲
http://localhost:1336/subsite
? - > 302 /帳號/登入RETURNURL =% 2fsubsite (即子網站犯規認爲其已認證)
而且我可以看到在列表中的Cookie在我的瀏覽器(其實際上存在)
我的配置中有什麼問題阻止了我的子網站共享父級cookie?
我對IISExpress
都設置在web.config中常見的machineKey? – 2013-03-24 20:18:06
@davea我的理解是,只有當這些站點位於不同的物理機器上時,才需要這樣做。這些都在我的開發箱上。這不是這種情況嗎? – 2013-03-24 20:22:25
我不認爲這是真的。我正在研究一個相反的項目。 1個主機,主要和子域(管理員和客戶端),我們不尊重簽名以保持劃分。我們不必配置此行爲。這是默認的。 Ergo,我認爲從同一臺機器託管沒有什麼區別。 – 2013-03-24 20:27:18