2
陳述中Fredrik's Blog post,他有一個C#示例if語句ASP.NET MVC3 - 如果在VB
@if (WebSecurity.IsAuthenticated) {
<li><a href="/user/login">Log in</a></li>
} else {
<li><a href="/user/logout">Log out</a></li>
}
但在VB我似乎無法弄清楚如何做同樣的事情
@If (HttpContext.Current.User.Identity.IsAuthenticated) Then
<div id="dialog-confirm" title="Log Out">
<div class="alert" title="Alert">
</div>
Are you sure?</div>
End If
這個節目是我的內部HTML標記是錯誤的。
基本上下面是有效的
@If (HttpContext.Current.User.Identity.IsAuthenticated) Then
End If
但任何內部的if語句被認爲是「代碼」,而不是去「標記」。我需要的是能夠在那裏放置標記。
有誰知道如何在Razor VB中做適當的if語句?
這回答一個相關的問題可能會有所幫助:http://stackoverflow.com/questions/4169340/razor-view-engine-quirks-in-vb-net/4171198#4171198 – Lucas 2010-11-13 17:24:25
你似乎是對的。 – 2010-11-13 17:29:19