你用 form 身份验证可以实现现的.系统自动会转到原来用户想看的地方.... http://www.cnblogs.com/gwazy/archive/2005/03/04/112643.aspx 有 demo 呢,你注意一下 web.config 中的设置 ......
if not login then response.redirect("/login.aspx?url=" & request.path) end if login.aspx:if username="123" and password="123" then response.redirect(request("url")) end if
response.redirect("/login.aspx?url=" & request.path)
end if
login.aspx:if username="123" and password="123" then
response.redirect(request("url"))
end if
在你的login.aspx页面里面,等用户的用户名密码严正通过后。然后判断Request.UrlReferrer.ToString是否为空,如果为空的话则你自己给他定一个页面如果不为空,就转向response.redirect(Request.UrlReferrer.ToString)
就可以了。这样就能实现你的效果
登陆的时候判断他是不是空的,空的就到首页什么的,不是就挑到returnURL咯
if(Session["name"]==""){
Response.Redirect("login.aspx?form="+Request.Path);
}在你的login.aspx登陆页面接受form参数。。
Session["name"]="小李";
if (Request.QueryString["form"]!=""){
Response.Redirect(Request.QueryString["form"]);
}else{
Response.Redirect("index.aspx");
}