How to request authentication in a menu item in Asp.net

2

I have the login form that is currently being used to log in, but I need to do this authentication also when I click on a particular menu item. I need that when clicking "Home", ask for this authentication again, and if the user has permission, enter if not not. How do I do this?

MasterPage:

<asp:Menu ID="Menu" runat="server" style="margin-bottom: 0" BackColor="White" 
            DynamicHorizontalOffset="2" Font-Names="Arial" Font-Overline="False" 
            Font-Size="Medium" Font-Strikeout="False" Font-Underline="False" 
            ForeColor="#7C6F57" StaticSubMenuIndent="10px" RenderingMode="List" OnMenuItemDataBound="NavigationMenu_MenuItemDataBound">
            <DynamicHoverStyle BackColor="#B2223D" ForeColor="White" />
            <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="5px" ForeColor="White" />
            <DynamicMenuStyle BackColor="#5D7B9D"  ForeColor="White" />
            <DynamicSelectedStyle BackColor="#FF0066" ForeColor="White"/>
            <Items>
    asp:MenuItem NavigateUrl="~/Index.aspx" Text="Home" Value="Home"></asp:MenuItem>
</Items>
            <StaticHoverStyle BackColor="#68655C" ForeColor="White" />
            <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="5px"  />
            <StaticSelectedStyle BackColor="#B2223D" ForeColor="White" />
        </asp:Menu>
    
asked by anonymous 07.10.2015 / 14:37

1 answer

1

If you want to use the same system login authentication, you could force a logout using FormsAuthentication.SignOut(); when it clicks the "Home" menu and redirect it to an authentication URL, like this: Response.Redirect("~/Login.aspx?ReturnUrl=%2fIndex.aspx"); . This would require you to authenticate again and redirect you to the "Home" page

    
10.10.2015 / 05:57