I have a simple ASP.Net login page. When the login button is clicked, the page should post back and the even should be handled by my server-side event handler. Instead, the page simply reloads. Page.IsPostBack
is false
.
我在“Load/Init”(如果适用的话)网页、ASPX网页和用户Control(ascx)的操作员的网页上打上了断点。 当我打洛因纽顿时,我不要再找回一个哨所,而把我的活动手叫来时,我只拿起页数,就像这是一次新的要求。
但是,这并不是目的! 日志页面使用单一电线参数:.aspx?id=123456
。 上述故障发生在使用该参数时。 然而,如果我能够URL Reott<>>>>>,以便查询 Carloin/123456
,那么这一错误确实发生而不是;我获得一个职位,而我的活动手则被召回。
因此,我为什么没有从我的网页上看到预期的行为? 改写的URL正在使问题消失?
登记号为<代码>。 缩略语
<asp:Button ID="SubmitLinkButton" runat="server" Text= Log In OnClick="SubmitLinkButton_Click"></asp:Button>
守则中的手法如下:
protected void SubmitLinkButton_Click(object sender, EventArgs e)
{
Authenticate();
}
www.un.org/chinese/ga/president
Edit (more code):
//Page_Init on the Master page
protected void Page_Init(object sender, EventArgs e)
{
if (HttpContext.Current.User.Identity.IsAuthenticated)
{
try
{
if (SessionFacade.User != null)
{
loginlabel.Text = "Logged in |";
LoginLink.Visible = true;
}
}
catch
{
FormsAuthentication.SignOut();
CacheFacade.RemoveSessionValues();
Session.Abandon();
Session.RemoveAll();
HttpContext.Current.Response.Redirect("~/Login.aspx");
}
}
else
{
loginlabel.Text = "";
LoginLink.Visible = false;
}
}
Page_Load on the ASPX page:
protected void Page_Load(object sender, EventArgs e)
{
if (this.IsPostBack.Equals(false))
{
/* Some business stuff that boils down to this: */
Session["company"] = Request["company"];
}
}
<>Page_Load on login Control:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
//honestly, there s no code here
}
}
P.S: I need to keep the non-url-rewrite way of accessing the login page, because many users are still navigating to that URL.
P.P.S:即使URL重写有缺陷,这一错误仍然存在。