亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

asp.net 頁(yè)面回跳實(shí)現(xiàn)代碼

 更新時(shí)間:2010年03月30日 13:05:46   作者:  
今天做登錄時(shí),遇到點(diǎn)小問(wèn)題,在網(wǎng)上找了一下,沒(méi)看到源碼案例,不過(guò)還是花了一點(diǎn)時(shí)間調(diào)試通過(guò)了在此記錄一下,備忘。
主要是Request.UrlReferrer的用法
注意: 如果上一頁(yè)面使用document.location方法導(dǎo)航到當(dāng)前頁(yè)面,Request.UrlReferrer返回空值
如果有A,B兩個(gè)頁(yè)面,在瀏覽器中直接請(qǐng)求A頁(yè)面,在A頁(yè)面的中Page_Load事件中導(dǎo)航到B 頁(yè)面,
則 Request.UrlReferrer返回空。因?yàn)?在Page_load事件中頁(yè)面還未初始化,所以無(wú)法記錄當(dāng)前頁(yè)的信息,
導(dǎo)航到b頁(yè)面也就無(wú)法獲得上一頁(yè)面的信息
復(fù)制代碼 代碼如下:

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request.UrlReferrer != null)
{
ViewState["UrlReferrer"] = Request.UrlReferrer.ToString();
}
if (Session["user"] != null)
{
if (Request.UrlReferrer != null)
{
Response.Redirect(Request.UrlReferrer.ToString());
}
else
{
Response.Redirect("/");
}
}
username.Value = Request.Form["Uname"];
pass.Attributes.Add("value", Request.Form["password"]);
}
}
/// <summary>
/// 個(gè)人會(huì)員登陸
/// </summary>
protected void userLog()
{
Lovetrip.BLL.Manage.Users bllu = new Lovetrip.BLL.Manage.Users();
Lovetrip.Model.Manage.Users modeu = bllu.Login(username.Value.Trim(), pass.Text.Trim());
if (modeu != null)
{
Session["user"] = modeu;
Session["userType"] = 1;
Command.Public.MoveUserSession(1);
bbsLogin(modeu.unick);
if (Request.UrlReferrer != null)
{
Response.Redirect(ViewState["UrlReferrer"].ToString());
}
else
{
Response.Redirect("/");
}
}
else
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('帳號(hào)或密碼輸入有誤!')", true);
}
}

相關(guān)文章

最新評(píng)論