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验证的啊 上传图片问题? SiteMapPath中的SkipLinkText 到底怎么用 播放器传到服务器上播放不了 怎么写正则批量替换一个HTML中的全部链接地址? [][][]没分了,问个用户控件DropDownList的问题 现在的网络我们还能够相信吗?有多少是真的? - 欢迎讨论 DataGrid 多表查询问题 Datagrid中模板列放linkbutton,linkbutton的事件怎么写。 花了6个晚上,把BLOG中的JS日历换成了C#产生的代码:) 请问:.net在同一时刻是不是只能产生一个页面? 实时同步数据库 急-请教一个单据录入问题
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接到参数后是怎么处理的。