谢谢!!!

解决方案 »

  1.   

    你在登录页里接收一个参数,比如comurl,等登录完后再回到那个页就可以了。
    这要求每个页在转向登录页时传递这个参数
    login.aspx?comurl=Request.servervariables["SCRIPT_NAME"].tostring();
      

  2.   

    表单验证情况下,由FormsAuthentication.GetRedirectUrl获得返回地址
      

  3.   

    有很多方法
    1:建立一个基页,每个需要验证权限的页面继承此页面,在基页中判断权限,权限不足转到登陆页面,转向时带一个参数,参数指明当前页面的地址,登陆页中设置一个默认转向地址,登陆后判断QueryString是否有你指定的参数,有就转向参数指向的地址,没有就转向默认地址.
    2.用表单验证,在web.config里面设置,但转向实际上也跟上面一样给你个简单的基页:
    public class validPage : System.Web.UI.Page
    {
    public validPage()
    {
    } private bool IsAuthenticated()
    {
    bool isAuthenticated=false; for (int i=0;i<Request.Cookies.Count;i++)
    {
    HttpCookie identity=new HttpCookie(Request.Cookies[i].Name,Request.Cookies[i].Value);
    isAuthenticated=(identity.Name=="IsAuthenticated");
    isAuthenticated=isAuthenticated && (identity.Value=="true"); if (isAuthenticated)
    break;
    } return isAuthenticated;
    } protected override void OnInit(EventArgs e)
    {
    base.OnInit(e);
    this.Load += new System.EventHandler(this.WYBPage_Load);
    } private void WYBPage_Load(object sender, System.EventArgs e)
    {
    if (!IsAuthenticated())
    Response.Redirect("Login.aspx?ReturnUrl="+Request.Url.AbsolutePath,true);
    }
    }
      

  4.   

    sansan123(火柴)讲的太好了,火柴火柴真是燃烧了自已,温暖了别人~~~
      

  5.   

    UserId = Trim(txtUserID.Value)
    PassWord = Trim(txtPWD.Value)Select Case CheckUser(UserId, PassWord)‘CheckUser是你自定义的用户名与密码校验方法
    Case 2
    Response.Redirect("Message/NoUser.htm")
    Case 1
    Session("UserId") = UserId
    Response.Redirect("main.aspx")
    Case 0
    Response.Redirect("Message/ErrorPwd.htm")
    ’……
    End Select
      

  6.   

    FormsAuthentication.GetRedirectUrl这样就可以了!表单验证
      

  7.   

    If Me.Request.QueryString("URL") = Nothing Then
                                    Me.Response.Redirect("/")
                                Else
                                    Me.Response.Redirect(Me.Request.QueryString("URL"))
                                End If
      If Not Me.Session("UserName") Is Nothing Then                
                Else                Me.Response.Redirect("Login.Aspx?URL=" & Me.Request.RawUrl & "")
                End If
      

  8.   

    将用的当前页面的url当作参数传过去就行