Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
I want to make application that if user in logged in the web site in one tab of browser and if he open application in second tab than he should not redirect to login page but he should redirect to Home page. just like Facebook or yahoomail in asp.net C#
 
please help
Posted 10-Sep-11 0:27am
Comments
Tarika Joshi at 10-Sep-11 6:03am
   
i need to give a different session id to the unique user every time he opens the same website in different window
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Set your home page is the default page in site URL and write code for checking authentication in page load, This will redirect your Home page to login page if the user not logged in
 

 
One way of doing this is
 
Step 1) Assign one session variable with login user on the log in time in login page
 
Step 2) check that above session variable on each pages page load (Check session variable is null or not)
 
Step 3) Assign null to session variable on log out
  Permalink  
v2
Comments
pchindhade at 10-Sep-11 5:44am
   
I have done that but in authenticating it is showing error of object reference not set.
 
I have written code like if cookie is null than redirect to login.aspx and if not null than to home page. but on login.aspx page load it is showing this error.
thank you for reply
please help
arunkumaraymuo at 10-Sep-11 5:50am
   
Use session variable instead of cookies
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi pchindhade,
 
If you use the session properly,you don't get such problems.
For details click below link
Click me
any more queries just place a comment.
Have a good time!!!
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 420
1 OriginalGriff 230
2 DamithSL 135
3 Dave Kreskowiak 110
4 Suvendu Shekhar Giri 110
0 OriginalGriff 7,740
1 DamithSL 5,644
2 Sergey Alexandrovich Kryukov 5,404
3 Maciej Los 5,011
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web04 | 2.8.141223.1 | Last Updated 10 Sep 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100