Click here to Skip to main content
15,914,250 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi
I have a login page when the login credentials are correct it will redirect to a page applyleave.aspx if I copy and paste the url of applyleave.aspx it should redirect to the loginpage and not to the applyleave.aspx, how to do it

Thanks
Posted
Comments
Sergey Alexandrovich Kryukov 17-Jan-12 1:51am    
Please tag it: ASP.NET.
--SA

check the following tutorial on implementing forms authentication:


http://msdn.microsoft.com/en-us/library/xdt4thhy.aspx[^]
 
Share this answer
 
In Login page

C#
if (authentication success)
{
Session["UserStatus"] = UserName.Text;
Server.Transfer("~/applyleave.aspx");
}
else
{
Response.Write("Retry");
}


In applyleave.aspx
On page load event
C#
if (Session["UserStatus"] != null)
{
}
else
Server.Transfer("~/applyleave.aspx");
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900