here is my web.config
<system.web><compilation debug="true" targetFramework="4.5" /><authentication mode="Forms"><forms defaultUrl="Timeline.aspx" loginUrl="~/Account/login.aspx" slidingExpiration="true" timeout=" 20 " /></authentication><authorization><deny users="?" /></authorization></system.web><location path="Timeline.aspx" /><location path="~/Account/ChangePassword.aspx"><system.web><authorization><allow users="?" /></authorization></system.web></location><location path="Timeline.aspx" /><location path="~/Account/Register.aspx" /></configuration>
code on landing page
protected void Page_Load(object sender, EventArgs e)
{
if (this.Page.User.Identity.IsAuthenticated)
{
string username = this.Page.User.Identity.Name;
Getbanner(username);
}
}
public void Getbanner(string username)if user wants to view Timeling page and the user didnt login redirect to login