开发者

Why is this cshtml giving run time error

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 />     
 }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜