Click here to Skip to main content
15,905,914 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have 6 page in my application. The names of my pages as flowing:

1. Home.aspx
2. Registration.aspx
3. UploadArticles.aspx
4. News.aspx
5. AdvanceSearch.aspx
6. SearchResult.aspx

Details: When my application is start the homepage(Home.aspx) will start and there is a login area as like facebook. Here I can go to News.aspx, Registration.aspx, AdvanceSearch.aspx easily. But, when I am using Session it always try to go in my homepage. And after login when I Search any thing it doesn't show SearchResult.aspx page it again go to Home.aspx file. But, If I not use Session its working perfectly. But, the problem is there is no information who is login now and I have some restriction in my project.

Thus why, I have to use session in my project as Login user and without Login user can access my application easily. As no force for non-registrar user for Registrar or Login. How, can I use session to do it? Please help me.
Posted

1 solution

check session on every page load
C#
if(!IsPostBack)
{
  if(Session["User"] == null)
    Response.Redirect("~/Login.aspx");
else
   {
        // Your Logic
   }
}
 
Share this answer
 
Comments
UL UL ALBAB 28-Feb-13 4:03am    
I have already done it. But, here is the problem that when none register user open this application they will not enable to access Search operation until they will not registrar. But, I want to enable everybody to do Search operation actually access another page to read only.

Thank you
Asim Mahmood 28-Feb-13 5:31am    
oh dear then remove session check from SearchResult page as user click any button on searchresult page check his session just like LinkedIn.

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