Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jun 09, 2012 01:00 PM by niranjan479
Jun 09, 2012 05:15 AM|LINK
I have a login page and to it a master page which contains menu bar and footer bar ..so I want to prevent the user from accessing master page content until and unless the user is logged in ...so please if anyone gives a solution for this i wouldbe thankfull
Jun 09, 2012 11:28 AM|LINK
I have a login page and to it a master page which contains menu bar and footer bar
1. You can simply hide the footer and menu of the master page at the login page
2. You can maintain a seperate master page for your login page (Easiest way)
3. Do not use a master page at all in your login page. If you are going to prevent the users from accessing it, what's the point of showing them at the login page? If you are going to hide the controls, then there is no point of having a master page. :)
Please 'Mark as Answer' if this post helps you.
Jun 09, 2012 11:49 AM|LINK
you can do this by Making the like Enable false and when user get login then you make them enable true at .cs page through coding.
hope this help you
Jun 09, 2012 12:14 PM|LINK
it will be like this
protected void btn1_Click(object sender, EventArgs e)
Link1.Enabled = true;
<asp:LinkButton ID="Link1" runat="server" Enabled="false" PostBackUrl="~/Default.aspx" Text="Enable"></asp:LinkButton><br />
<asp:Button ID="btn1" runat="server" Text="enable true" onclick="btn1_Click" />
In this way you and enable and disable your controls while login and logout button click.
Hope this will help you
Jun 09, 2012 12:53 PM|LINK
ya i thought of hiding the master page but my requirement is to make it visible but not to access it until n unless the user logins..
Jun 09, 2012 12:58 PM|LINK
but my requirement is to make it visible but not to access it until n unless the user logins
Are you using asp.net membership to implement the authentication? If so, you can check
//Disable all buttons in master page.
Check the condition on Page_Load event of the master page. If you aren't using asp.net membership, check whether user is logged in or not according to your implementation of the login and if the user is not logged in, disable all the controls in footer and
Jun 09, 2012 01:00 PM|LINK
Thanks sanjay that was very much helpful...