Click here to Skip to main content
16,018,092 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
when we copy the url to another browser it should be redirected to login page only.

in my project ,Its working but have some problem.if i run my project in chrome and copy the url in mozilla ,it redirected into my login page.but in mozilla if i open a new tab and copy the url it shows my current page instead of login page.once i close all tab in mozilla and do the same thing mean it is working .Why this problem happening pls help me.


Now am using lik this :


Collapse | Copy Code

in Global.asax

C#
protected void Application_Start(object sender, EventArgs e)
        {
 
        }
 
        protected void Session_Start(object sender, EventArgs e)
        {
            Response.Redirect(Request.Url.GetLeftPart(UriPartial.Authority) + VirtualPathUtility.ToAbsolute("~\\Home.aspx"));
        }
 
        protected void Application_BeginRequest(object sender, EventArgs e)
        {
 
        }
 
        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {
 
        }
 
        protected void Application_Error(object sender, EventArgs e)
        {
 
        }
 
        protected void Session_End(object sender, EventArgs e)
        {
            Response.Redirect(Request.Url.GetLeftPart(UriPartial.Authority) + VirtualPathUtility.ToAbsolute("~\\Home.aspx"));
        }
 
        protected void Application_End(object sender, EventArgs e)
        {
 
        }
    }
}




.Shall i use any other method in web config ,pls help me.
Posted
Updated 21-Jan-12 22:56pm
v4

1 solution

There is a basic concept in asp.net called "Sessions". I suggest you read about it if you haven't. Usually a single session is maintained across all tabs in a single browser instance. Nowadays all browsers support tab based browsing, and almost all browsers have been designed to have a single session across multiple tabs for the same browser instance - it has been designed that way for specific reasons which has its own share of pros and cons. Have a look at this link to understand more about it.

http://geekswithblogs.net/ranganh/archive/2009/04/17/asp.net-session-state-shared-between-ie-tabs-and-ie8.aspx[^]

You try the same exercise by opening a totally different browser instance of Mozilla, it will surely re-direct to the login page.
 
Share this answer
 
v3
Comments
Uday P.Singh 22-Jan-12 5:31am    
agree 5+
priya from Madras 22-Jan-12 5:55am    
Thanks Abey i ll try this method .
Abey Thomas 22-Jan-12 8:10am    
I dont understand when u said "when u use session".. You were redirected to the same page when u used tabs is just because sessions were used internally.. Probably you never realized that sessions are already being used..
priya from Madras 22-Jan-12 8:51am    
In that link they said ,use


sessionState mode="InProc" cookieless="UseUri"


But this is not working , it display the current page instead of login page
priya from Madras 23-Jan-12 8:05am    
ya i knew the concept u said, but i need to redirect the login page . not same page

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