当我们将网址复制到另一个浏览器时,应仅将其重定向到登录页面. [英] when we copy the url to another browser it should be redirected to login page only.

查看:147
本文介绍了当我们将网址复制到另一个浏览器时,应仅将其重定向到登录页面.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们将网址复制到另一个浏览器时,应仅将其重定向到登录页面.

在我的项目中,它可以正常工作,但是有一些问题.如果我在chrome中运行我的项目,然后在mozilla中复制url,它将重定向到我的登录页面.但是在mozilla中,如果我打开一个新标签并复制url,它将显示我的当前页面而不是登录页面.一旦我关闭了mozilla中的所有选项卡,并做同样的事情意味着它正在工作.为什么发生此问题,请帮我.


现在正在使用lik this:


收合|复制代码

在Global.asax中

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

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)
        {
 
        }
    }
}





我可以在Web配置中使用其他任何方法,请帮助我.





.Shall i use any other method in web config ,pls help me.

推荐答案

asp.net中有一个称为会话"的基本概念.如果您还没有的话,我建议您阅读一下.通常,在一个浏览器实例中的所有选项卡上都维护一个会话.如今,所有浏览器都支持基于选项卡的浏览,并且几乎所有浏览器都被设计为针对同一浏览器实例在多个选项卡之间具有单个会话-出于特定原因,它被设计为具有各自的优缺点.请查看此链接以了解更多信息.

http://geekswithblogs.net/ranganh/archive/2009/04/17/asp.net-session-state-shared-between-ie-tabs-and-ie8.aspx [
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.


这篇关于当我们将网址复制到另一个浏览器时,应仅将其重定向到登录页面.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆