2013-10-12 41 views
3

我有一個配置了區域的MVC應用程序。註銷鏈接出現在佈局頁面中,因此它顯示在每個頁面上。當我點擊它總是徘徊無論它是在該地區追加它註銷...如何在MVC中爲表單指定區域4

我只是希望它去帳戶\註銷 - 沒有面積

我嘗試以下,但它沒有工作... 有什麼建議麼?

@using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", area="" })) 
{ 
    @Html.AntiForgeryToken() 
    <a href="javascript:document.getElementById('logoutForm').submit()">Log off</a> 
} 

回答

3

您正在使用不同的過載。我認爲你應該做的,如下:

@using (Html.BeginForm("LogOff", "Account", new { area = ""}, FormMethod.Post, new { id = "logoutForm" })) 
{ 
    @Html.AntiForgeryToken() 
    <a href="javascript:document.getElementById('logoutForm').submit()">Log off</a> 
} 
+0

真棒感謝堆.... – user2206329

+0

@ user2206329很樂意幫助你:) –

相關問題