Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
this is my application s menu..
I want that before authentication the first tabs be clear and after that I want that the other tabs will be clear and the first tabs disapear!!!!!!





<% if (Request.IsAuthenticated)
{ %>
  • <%: Html.ActionLink("test", "test", "Home")%>

<% } %>

Posted
Comments
joshrduncan2012 3-Jan-13 15:15pm    
What is the problem exactly?

1 solution

You're not using Razor, in MVC4 ? Why not ?

You need to do the check if the user is authenticated and then do an 'else' to render the other stuff only when they are not.
 
Share this answer
 
Comments
loylmed 7-Jan-13 8:20am    
can u give me an example plz?
Christian Graus 7-Jan-13 14:24pm    
<% if (Request.IsAuthenticated)
{ %>
<%: Html.ActionLink("test", "test", "Home")%>
<% } %>
else
{
<%: Html.ActionLink("Home", "Index", "Home") %>
<%: Html.ActionLink("Assurancequalité", "AQ", "Home") %>
<%: Html.ActionLink("Control qualité","CQ", "Home">
}
loylmed 10-Jan-13 3:30am    
thx but how can i get a test with the userName???
because every user has her property tabs
Christian Graus 10-Jan-13 15:09pm    
Then you need to add code that pulls out the user name and checks it. Better yet, I would have a model that returned a list of tabs to show for the current user, and take the logic out of the cshtml. The cshtml should just know that it only shows tabs the view tells it to

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900