English 中文(简体)
ASP. 净页
原标题:ASP.Net Page Not Posting Back - Reloading Instead

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重写有缺陷,这一错误仍然存在。

最佳回答

每当我过去看到这一问题时,它通常被归结为“URL”重新撰写。 我通常会到Fiddler,以追踪吉卜赛人协会的活动。 我的王家在你点击ton子后告诉我,看看医生组织的要求后,很快会把302台转往日志。

You note that "The above failure occurs when using this parameter" of the login.aspx page. Are you certain there is no url-rewriter configuration that for example, may strip out any querystring values and do a redirect?

问题回答

检查你的政策。 您的请求显然已经过时。

我清除了我E浏览器的历史,问题消失了。

你们是否试图使用不同的浏览器? 一旦我有同样的问题,它就通过重新安插来解决!





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!