Can anybody tell me why is this code giving runtime error:
@if (Request.IsAuthenticated) {
Welcome <b>Page.User.Identity.Name;</b>!
[ Html.ActionLink("Log Off", "LogOff", "Account"); ]
<br />
开发者_运维技巧 <br />
[ Html.ActionLink("Change Password", "ChangePassword", "Account"); ]
<br />
}
else {
[Html.ActionLink("Candidate Login", "LogOn", "Account",new { id = 1 },null);]
<br />
<br />
[Html.ActionLink("Employer Login", "LogOn", "Account", new { id = 2 }, null);]
<br />
}
What should I do to avoid it? I am getting crazy behind these braces and html mixed up
I'll give it a shot:
@if (Request.IsAuthenticated) {
Welcome <b>@Page.User.Identity.Name</b>!
@Html.ActionLink("Log Off", "LogOff", "Account")
<br />
<br />
@Html.ActionLink("Change Password", "ChangePassword", "Account")
<br />
}
else
{
@Html.ActionLink("Candidate Login", "LogOn", "Account",new { id = 1 },null)
<br />
<br />
@Html.ActionLink("Employer Login", "LogOn", "Account", new { id = 2 }, null)
<br />
}
精彩评论