在我的Footer.cshtml
我有一個用於驗證用戶的開關,並檢查模型是否已經提供。if-block裏面的標籤和@model
@model AngemeldeterBenutzerModel
@if (User.Identity.IsAuthenticated && Model != null)
{
<span class="span2">Eingelogt als @model.AnzeigeName</span>
<span class="offset1 span9">Zuletzt eingelogt mit "@model.LastLoginIp" um "@model.LastLoginDate"</span>
}
這一觀點得到在_Layout.cshtml
呈現如下:
<div id="footer" class="container-fluid">
@{ Html.RenderAction("Footer", "Navigation"); }
</div>
但是我得到這個分析器錯誤:
The if block is missing a closing "}" character. Make sure you have a matching "}" character for all the "{" characters within this block, and that none of the "}" characters are being interpreted as markup.
但我關上了if
- 塊在最後。我還試圖用<text>
標籤圍繞內容,或者在兩個跨段之前使用@:
。
在哪一點違反語法?
我假設模型的屬性實際上不是'.Foo'和'.Bar',你能展示真實的代碼嗎? –
包含現在的真實代碼 –