跳转到登录窗口时加B.aspx?url=A.aspx
然后在程序获取返回页面~~

解决方案 »

  1.   

    在Asp.net的Web.config文件中进行设置认证模式为Form(具体可以参考MSDN)验证之后利用Request.UrlReferrer获取以前的路径转向就好了
      

  2.   

    但是我在A.aspx页面中打开B.aspx,其中B.aspx要求身份验证,这时跳到登录页面。在登录页面中Request.UrlReferrer得到的是A.aspx。我想返回到B.aspx,不能得到B.aspx。
      

  3.   

    history.back() 不可以实现么?
      

  4.   

    我认为这将很难做到,
    因为只用再页面生命中的最后一个标志是 Unload 事件之后,也就是最后,浏览器接收 HTTP 响应数据包并显示页面。这时浏览器才能知道你的url,而你的事件在可能是在Page_Load就跳转到登录页面中,所以登录页面中Request.UrlReferrer得到的是A.aspx
      

  5.   

    在b.aspx页用logon.aspx?url=b.aspx方式吧
      

  6.   

    (1)在WEB.CONFIG中配置
     1.<authentication mode="Forms">
                <forms name="webauth" loginUrl="login.aspx" protection="All" path="/" />
                </authentication>
     2.<location path="webform1.aspx"> 此处webform1.aspx是你需要验证的页面,可以配置
            <system.web>                 无限多个<location path>
                 
            <authorization>
                    <deny users="?" />
                </authorization>
            </system.web>
        </location>(2)在login.aspx中
      1。导入namespace 
      imports System.Web.Security
      2。在输入登录信息,按下确定按钮的事件中添加
      FormsAuthentication.RedirectFromLoginPage(userid, true或者false)
    //附redirectfromloginpage说明
       public shared sub redirectfromloginpage(username as string,createpersistantcookie as boolean)