怎样实现用户登陆后,页面自动跳转到最初请求页面? 我希望是获取当前网页的地址,跳转到login.aspx里面,然后等待3秒,再跳转到登陆前的页面。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 settimeout函数里面写window.location 可以传参啊。首先记录下现在的页面的URL。然后传到登陆页面登陆成功后response.write("<script>alert('登陆成功');location.href='"+URL+"'</script>")或者是response.redirect(URL); 可以传参啊。 首先记录下现在的页面的URL。然后传到登陆页面 登陆成功后 response.write(" <script>alert('登陆成功');location.href='"+URL+"' </script>") 或者是 response.redirect(URL);支持一下 第1步 用Response.redirect("login.aspx");并且传入一个标示比如id=wochuande第2步 在login.aspx上面的Load事件中检索是否有这个id=wochuande如果有的话,代表这个界面是经过我指定的界面跳转过来的,然后执行我的步骤,调用延时函数3停留3秒 然后response.redirect("您要的地址") 思路我都已经说了 ,是这个样子的,至于调用延时函数好像是sleep什么的 你查下 我给忘了 想知道怎样获取那个Url... 在前一个网页里面这么写 Response.Redirect("login.aspx?fromUrl=" + System.Web.HttpContext.Current.Request.Url.AbsoluteUri.ToString()); 在login.aspx里面这么写 <meta http-equiv="refresh" content="10; url=<% =Request.QueryString["fromUrl"].ToString() %>" /> Request.UrlReferrer获取有关客户端上次请求的URL信息 ……登陆成功之后string strURL=request["ReturnURL"];//这个是用户请求的页面路径System.Web.Security.FormsAuthentication.SetAuthCookie(user.Name,true);//给用户颁发Cookie凭证if(strURL==null){ //用户原请求页面为空时 Reaponse.Redirect("aaa.aspx");}else{ Response.Redirect(strURL);//用户原请求页面不为空时,转到请求页面}……====用户退出System.Web.Security.FormsAuthentication.SignOut(); 用的是Login控件和MemberShip组件。 那个ASP.NET 有身份验证,就是你没有登录的话匿名用户只能访问你自己定义的几个页面。然后跟与那个URL返回你以前单击的页面。自己去搜下ASP.NRT身份验证,然后在接合我给你的代码看下就知道了。WENCONFIG 中还要加东西,这里我就不给出来了。 if (Is_Valid_code) { if (Is_Valid_User) { //-------------读取用户权限 string Power_ID = db.MyDR.GetSqlValue(0).ToString(); //创建一个验证票据 FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, TextBox_UserName.Text.Replace(" ", ""), DateTime.Now, DateTime.Now.AddHours(1), true, Power_ID); //进行加密 string cookieStr = FormsAuthentication.Encrypt(ticket); //创建一个cookie,cookie名为web.config设置的名,值为加密后的数据cookieStr, HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, cookieStr); cookie.Path = FormsAuthentication.FormsCookiePath;//设置cookie保存路径 //--------------读取要保存的时间 if (RadioBtnL_CookieTime.SelectedItem.Text == "一小时") { cookie.Expires = DateTime.Now.AddHours(1); } else if (RadioBtnL_CookieTime.SelectedItem.Text == "即时") { //如果是即时的话不用设置cookie过期时间浏览器关闭后cookie自动消失 } else { int x = Convert.ToInt16(RadioBtnL_CookieTime.SelectedValue); cookie.Expires = DateTime.Now.AddDays(x); } Response.Cookies.Add(cookie); string strRedirect = Request["ReturnUrl"];//取出返回url if (strRedirect == null) { strRedirect = "index.aspx"; } Response.Write("<script language=javascript>alert('登录成功,欢迎访问本论坛');location='" + strRedirect + "'</script>"); editplus运行aspx 文件问题 网站发布问题 邮件发送在本地是成功,网上是失败的 学习petshop4.0的疑惑 郁闷极了,郁闷了半天,DataGrid编辑状态下的问题 生成邮件的问题。 如何设置asp的写入权限? [求助] 关于Report Service 的问题,请大家帮帮忙,急!!! 跪求asp.net ashx $.post callback无效问题 求问 .NET 大数据解决方案或思路 什么是触发器 一个关于title的问题
登陆成功后
response.write("<script>alert('登陆成功');location.href='"+URL+"'</script>")
或者是
response.redirect(URL);
登陆成功后
response.write(" <script>alert('登陆成功');location.href='"+URL+"' </script>")
或者是
response.redirect(URL);支持一下
在login.aspx里面这么写 <meta http-equiv="refresh" content="10; url=<% =Request.QueryString["fromUrl"].ToString() %>" />
获取有关客户端上次请求的URL信息
string strURL=request["ReturnURL"];//这个是用户请求的页面路径
System.Web.Security.FormsAuthentication.SetAuthCookie(user.Name,true);//给用户颁发Cookie凭证
if(strURL==null)
{
//用户原请求页面为空时
Reaponse.Redirect("aaa.aspx");
}
else
{
Response.Redirect(strURL);//用户原请求页面不为空时,转到请求页面
}
……
====
用户退出
System.Web.Security.FormsAuthentication.SignOut();
那个ASP.NET 有身份验证,就是你没有登录的话匿名用户只能访问你自己定义的几个页面。然后跟与那个URL返回你以前单击的页面。自己去搜下ASP.NRT身份验证,然后在接合我给你的代码看下就知道了。WENCONFIG 中还要加东西,这里我就不给出来了。
if (Is_Valid_code)
{
if (Is_Valid_User)
{
//-------------读取用户权限
string Power_ID = db.MyDR.GetSqlValue(0).ToString();
//创建一个验证票据
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, TextBox_UserName.Text.Replace(" ", ""),
DateTime.Now, DateTime.Now.AddHours(1), true, Power_ID);
//进行加密
string cookieStr = FormsAuthentication.Encrypt(ticket); //创建一个cookie,cookie名为web.config设置的名,值为加密后的数据cookieStr,
HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, cookieStr);
cookie.Path = FormsAuthentication.FormsCookiePath;//设置cookie保存路径 //--------------读取要保存的时间
if (RadioBtnL_CookieTime.SelectedItem.Text == "一小时")
{
cookie.Expires = DateTime.Now.AddHours(1);
}
else if (RadioBtnL_CookieTime.SelectedItem.Text == "即时")
{
//如果是即时的话不用设置cookie过期时间浏览器关闭后cookie自动消失
}
else
{
int x = Convert.ToInt16(RadioBtnL_CookieTime.SelectedValue);
cookie.Expires = DateTime.Now.AddDays(x);
} Response.Cookies.Add(cookie); string strRedirect = Request["ReturnUrl"];//取出返回url
if (strRedirect == null)
{
strRedirect = "index.aspx";
}
Response.Write("<script language=javascript>alert('登录成功,欢迎访问本论坛');location='" + strRedirect + "'</script>");