Click here to Skip to main content
12,758,462 members (31,621 online)
Rate this:
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 C#

please help
Posted 10-Sep-11 0:27am
Tarika Joshi 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
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
pchindhade 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 10-Sep-11 5:50am
Use session variable instead of cookies
Rate this: bad
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!!!

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

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170217.1 | Last Updated 10 Sep 2011
Copyright © CodeProject, 1999-2017
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