이 궁금 : 면도기, ASP.Net, 사용자 인증
@if(Request.LogonUserIdentity.IsAnonymous){
<ul id="menu">
<li>@Html.ActionLink("Location", "Index", "Location")</li>
<li>@Html.ActionLink("Map", "Map", "Home")</li>
<li>@Html.ActionLink("Help", "Help", "Home")</li>
</ul>
@}else if(Request.LogonUserIdentity.IsAuthenticated){
<ul id="menu">
<li>@Html.ActionLink("Location", "Index", "Location")</li>
<li>@Html.ActionLink("Service", "Index", "Service")</li>
<li>@Html.ActionLink("Service Assignment", "Index", "ServiceAssignment")</li>
<li>@Html.ActionLink("Content Management", "Index", "Content")</li>
</ul>
@}
다음과 같은 오류를 던지고있다 :
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1501: No overload for method 'Write' takes 0 arguments
이 오류는 내 else if
블록에 발생합니다. 나는 ASP.net과 면도기를 처음 사용하지만, 내가 한 일을 올바르게 생각하면 올바른 것인가? 둘 다 부울 반환이기 때문에.
을하거나 @if 사용
은 다음과 같이하십시오. 각 블록 내의 HTML 태그가 유효하기 때문에 Razor는 else if 및 closing bracket이 코드임을 알 수 있습니다. –
@JasonBerkan - 좋은 지적입니다. 나는이 두 가지 방법이 그 시점에서 스타일 선택이라고 생각한다. – Tommy