Click here to Skip to main content
15,886,067 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear sir/ma'am


I complete my site when i run it on the client side the my site is running with default page login page(112.140.1.8/frmlogin.aspx).
But problem isthat if anyone run my site with(112.140.1.8/report.aspx) then also the report page is directly accessible.

Sir help me regarding this
Posted

You need to provide authentication and authorization for your website. See the links below:
ASP.NET authentication and authorization[^]
Authentication and Authorization in ASP.NET Web API[^]
Authentication and Authorization in ASP.NET[^]
Authentication and Authorization in ASP.NET[^]

Check for the session for UserID, if it is unavailable then redirect user to login page.
Try this:
C#
//Session name should be same as you are setting after successful login
if(Session["UserID"] == null)
{
    Response.Redirect("Login.aspx");
}



--Amit
 
Share this answer
 
Comments
ankur789 20-Mar-13 5:40am    
sir i run my site in 3 computers first one is the server 2 others are client
my first page is login
page
but when i put url with any other page in the client computer it is also open directly
_Amy 20-Mar-13 5:42am    
Go for links. You need to use Authentication and Authorization in your website. There is no other way to do that.
Please follow below authentication..

1. After login sucessfully set session id.
2. In all other page load event check whether the Session id is empty or not..

3. If the session id is empty then redirect to Login page else
4. continue with your code..

Refer solution 1 to check whether Session id is empty or not...

Hope it helps you..
 
Share this answer
 

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