I want to create login user control in asp.net mvc site , to be used in multiple pages for the normal pages i have view , controller , model how i will handle all this stuff for this user control
A:
<% 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"); %>
<% }
- LoggedInSidebar points to
~/Views/Shared/Sidebar/LoggedInSidebar.ascx - LogInSidebar points to
~/Views/Shared/Sidebar/LogInSidebar.ascx
Dan Atkinson
2010-01-10 19:07:24
A:
Silly question @Ahmed but can't you use the one that is generated when you create a new MVC project?
It's in the Shared folder called LogOnUserControl.ascx.
griegs
2010-01-10 21:45:49
Silly reply @griegs because I need login control Username/password not action links
Ahmed
2010-01-11 07:04:20