<pre><body> <form id="form1" runat="server"> <div class="menu"> <ul> <li class="navigation_first_item"><a href="Default.aspx">Home</a></li> <li class="navigation_s"><a href="Add User.aspx">Add User</a></li> <li><a href="Registrationpage.aspx">Register Employee</a></li> <li><a href="Contact.aspx">Contact</a></li> </ul> <div class="logoutLblPos"> <label class="logoutLblPos"> </label> <br /> <div> <span class="auto-style1">Time</span> <span class="auto-style2">:</span> <asp:Label ID="lbltime" Text="" runat="server" Style="color: black"></asp:Label> </div> <span class="auto-style3"><span class="auto-style4">User </span> :</span><asp:Label ID="lblusername" Text="" runat="server" Style="color: black"></asp:Label> <br /> <asp:Button ID="btnlogout" Text="logout" runat="server" OnClick="btnlogout_Click" Style="height: 26px"></asp:Button> </div> <div class="left"></div> <div class="right"></div> <div class="clear"></div> <div class="content"></div> <div class="Content"> <asp:ContentPlaceHolder ID="ContentBody" runat="server"> </asp:ContentPlaceHolder>
Quote:Sometimes you want to allow public access to your registeration page and want to restrict access to rest of the site only to logged / authenticated users .i.e. do not allow anonymous access. Say your registration page is called register.aspx in your site's root folder. In the web.config of your website's root folder you need to have following setup. <configuration> <system.web> <authentication mode="Forms"/> <authorization> <deny users="?"/> //this will restrict anonymous user access <location path="register.aspx"> //path here is path to your register.aspx page e.g. it could be ~/publicpages/register.aspx <system.web> <authorization> <allow users="*"/> // this will allow access to everyone to register.aspx Till now we saw either allow users or to authenticated users only. But there could be cases where we want to allow particular user to certain pages but deny everyone else (authenticated as well as anonymous).
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)