http://xxx.xxx.x.xxx/login.aspx?ReturnUrl=%2fDefault.aspx我要怎么做才能这样 http://xxx.xxx.x.xxx/login.aspx?ReturnUrl=%2fDefault.aspx我要怎么做才能这样,asp.net运行时是先运行default.aspx页面吗 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 就是个登陆验证比如这种 string userName = txtUserName.Text; string userPass = txtUserPass.Text; int userId = BlogLogic.checkLogin(userName, userPass); if (userId > 0) { Session["userId"] = userId; Session["userName"] = userName; //Response.Redirect("MyFirst.aspx"); FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, userName, DateTime.Now, DateTime.Now.AddMinutes(20), true, ""); string encryptTicket = FormsAuthentication.Encrypt(ticket); HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptTicket); Response.Cookies.Add(cookie);//向cookies数组中添加一个cookie if (Request.QueryString["ReturnUrl"] == null) { Response.Redirect("MyFirst.aspx"); } else { Response.Redirect(Request.QueryString["ReturnUrl"]); } } else { Response.Redirect("Welcome.aspx"); }你在地址栏就可以看到这个效果了 ReturnUrl是你的参数名,你把这个参数传到login.aspx了。运行先加载login.aspx,然后登录后,估计可以跳转到Default.aspx这个是参数,具体执行情况要看在login.aspx接到参数后是怎么处理的。 程序运行不是先运行default.aspx的吗,怎么会运行login.aspx啊,是不是要设置啊 ASP.NET 会执行页面, 而页面是login.aspx 问号后面都是参数 不是页面名称。 FormsAuthentication.RedirectFromLoginPage 是login.aspx在default.aspx执行之前执行还是default.aspx执行时调用login.aspx验证的啊 in2bits.MyXls 如何设定行高? 求怎么在网页运行前加载开场动画。进者帮顶有分 ext.net更换主题 sharepoint server 2013 和project server 2013 及visio 2013 英文版下载 关于ASP.NET MVC session怎样在多个二级域名间通用? asp.net如何实现下拉框即可以选择下拉值也可以输入文本 为什么我下载的例子总是不能运行呢? 如何得到EXCEL中单元格的数据???? C#怎样写一个传递二维数组的方法呢? 实时同步数据库 急-请教一个单据录入问题
string userPass = txtUserPass.Text;
int userId = BlogLogic.checkLogin(userName, userPass);
if (userId > 0)
{
Session["userId"] = userId;
Session["userName"] = userName;
//Response.Redirect("MyFirst.aspx"); FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, userName, DateTime.Now, DateTime.Now.AddMinutes(20), true, "");
string encryptTicket = FormsAuthentication.Encrypt(ticket);
HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptTicket);
Response.Cookies.Add(cookie);//向cookies数组中添加一个cookie
if (Request.QueryString["ReturnUrl"] == null)
{
Response.Redirect("MyFirst.aspx");
}
else
{
Response.Redirect(Request.QueryString["ReturnUrl"]);
}
}
else
{
Response.Redirect("Welcome.aspx");
}你在地址栏就可以看到这个效果了
运行先加载login.aspx,然后登录后,估计可以跳转到Default.aspx这个是参数,具体执行情况要看在login.aspx接到参数后是怎么处理的。