Click here to Skip to main content
12,830,304 members (50,159 online)
Rate this:
Please Sign up or sign in to vote.
See more: ASP.NET MVC4
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 3-Jan-13 1:54am
joshrduncan2012 3-Jan-13 15:15pm
What is the problem exactly?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.
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")%>
<% } %>
<%: 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)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170326.1 | Last Updated 3 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100