就是比如我要访问a.aspx然后由于没有登录,重定向到login.aspx了,然后我登录以后,怎么获取他之前是请求a.aspx的地址的?

解决方案 »

  1.   

    href = Request.Url.AbsoluteUri.ToString();
     if (Request.Cookies["admin"] == null)
            {
                Response.Write("<script>alert('连接超时,请重新登陆!');location.href='Login.aspx?url=" + href + "';</script>");
            }//获取当前URL判断指定跳转
                if (href == null)
                {
                    Response.Redirect("index.html");
                }
                if (href != null)
                {
                    Response.Redirect("" + href + "");
                }
      

  2.   

    转到登录的时候先url吧上张网页的网址一起传过来登录以后就可以跳转了~!
      

  3.   

    就是比如我要访问a.aspx然后由于没有登录,重定向到login.aspx了,然后我登录以后,怎么获取他之前是请求a.aspx的地址的?=========当访问 a.aspx 的是,重定向的的时候将 a.aspx 传倒 login.aspx 都是这样的处理的啊// a.aspx.csif(没有权限) {
      Response.Redirect("login.aspx?returnUrl=" + Request.RawUrl);
    }
    //login.aspx.cs
    if(登录登录成功) {
     if(!String.IsNullOrEmpty(Request.QueryString["returnUrl"]) {
           Response.Redirect(Request.QueryString["returnUrl"]);
     } else {
          Response.Redirect(默认页面);
     }
    }
      

  4.   

    使用Request.UrlReferrer,获得转跳前一页面的URL,登入成功后,再转跳。