Securing archive page?

Jun 29, 2010 at 11:42 AM
Edited Jun 29, 2010 at 11:56 AM

I have manged to secure every page in my blog so if a user tries to view and page or blog entry they are re directed to the login page. However I have made the archive page my homepage so if you go to http://localhost/default.aspx a user is able to view the archive page. It is possible to re direct this page to the login screen if the user is not logged in?

I have also just noticed that the search box still works if the user is not logged it. Is it possible to redirect the search results page or hide the search box if the user is not logged in



Jun 29, 2010 at 12:18 PM

I have managed to solve this by adding the following to Archive.aspx.cs and Search.aspx.cs inside the  Page_Load method section

if (!User.Identity.IsAuthenticated) Response.Redirect("login.aspx"); // can change page to another other page, like a registration page.