The mvc part view (Partial) displays the changes before and after login and the Shared folder is not displayed in solution Resource Manager,
At the beginning, my Solution Explorer did not display the Shared folder, but the Shared folder actually exists in the project, I searched for a keyword that seems to be inaccurate ). Later, I read vs2012.
In fact, the solution is very simple:
First, view-solution Resource Manager. In Solution Explorer, click "show all files" in the red box ".
Then a file similar to the image appears. Find the file you want, right-click it, and click "include in Project" in the red box.
The mvc branch view displays changes before and after logon.
The effect is as follows:
Before Logon :;
After login:
First, right-click the Shared folder and add the view: (for example)
In the segment View:
<% @ Control Language = "C #" Inherits = "System. web. mvc. viewUserControl "%> <% if (Session [" NICKNAME "] = null) {%> <ul class = "loginTop"> <li> <a href = "<% = Url. action ("Login", "Account ") %> "rel =" nofollow "> logon </a> </li> <li >|</li> <a href =" <% = Url. action ("Register", "Account ") %> "rel =" nofollow "> Registration </a> </li> </ul> <%} else {%> <dl class =" collapsible_menu "> <dt> <span id = "nowrap"> <% = Session ["NICKNAME"] %> </span> <span id = "noticeDot" class = "red dn"> </span> <I> </dt> <dd> <a href = "#" rel = "nofollow"> my resume </a> </dd> <dd> <a href = "#"> my favorite positions </a> </dd> <a id = "noticeNo" href = "#"> my shipping <span class = "red dn"> </span> </a> </dd> <dd class = "btm"> <a href = "#"> me </a> </dd> <a href = "#"> I want to recruit </a> </dd> <a id =" accountSetting "href =" # "> account settings </a> </dd> <dd class =" logout "> <a href =" # "rel =" nofollow "> exit </a> </dd> </dl> <%} %>
The proper location on the master page:
<%=Html.Partial("Partial1") %>