我想在asp.net mvc站点中创建登录用户控件,以便在多个页面中使用我有视图、控制器、模型的普通页面,我将如何处理此用户控件的所有这些东西
发布于 2010-01-11 03:07:25
<% if(User.IsAuthenticated) { %>
<%-- User is logged in, show them the sidebar to do with their account --%>
<% Html.RenderPartial("Sidebar/LoggedInSidebar"); %>
<% } else { %>
<%-- User needs to log in, show them a sidebar that asks for their credentials --%>
<% Html.RenderPartial("Sidebar/LogInSidebar"); %>
<% }~/Views/Shared/Sidebar/LoggedInSidebar.ascx~/Views/Shared/Sidebar/LogInSidebar.ascx发布于 2010-01-11 05:45:49
愚蠢的问题@Ahmed,但您不能使用在创建新的MVC项目时生成的问题吗?
它位于名为LogOnUserControl.ascx的共享文件夹中。
https://stackoverflow.com/questions/2038076
复制相似问题