c# - Prevent page reload when setting session variable -
i have asp button, , on click event session variable set , page redirected. problem process requires 2 clicks - once set session , redirect. how can set session , redirect in 1 click? code follows:
protected void btn_login_click(object sender, eventargs e) { httpcontext.current.rewritepath("anotherpage.aspx"); session.add("user-id", _id); }
protected void btn_login_click(object sender, eventargs e) { session.add("user-id", _id); response.redirect("anotherpage.aspx"); }
Comments
Post a Comment