aspx Page events execute twice after HTTP POST

Discussion in 'ASP .Net' started by Lewis, Aug 20, 2003.

  1. Lewis

    Lewis Guest

    Hi,

    Im having a problem with an aspx page that I'm building (and rather urgently
    needing to complete!).

    Situation is this...
    Im transforming some XML using an XSLT which builds an HTML form using an
    aspx (C# - using VS.NET). Within the resulting HTML is a form, which
    contains the following :
    <form method="POST" action="recieveForm.aspx?lang=eng">

    That posts to the page 'recieveForm.aspx'.
    'recieveForm.aspx' recieves the form and processes the data from the form
    elements
    and stores them in a database.

    The issue I have is that the Page_Load event (which calls my subsequent data
    store method) gets called twice, and after further testing it appears all
    the page methods run twice.Which results in me having duplicate records
    within my data table.

    Having searched through a lot of articles in the newsgroups I can't seem to
    find a resolution or a reason for this happening.

    I am not implementing AutoEventWireUp and I do not have a Handles
    declaration at the end of the Page_Load Method.
    IsPostBack is false both times the method is executed.

    What Im looking for is a solution and hopefully an explanation of why this
    should happen - surely you can post an HTML form to an aspx page and recieve
    the Headers as normal?

    Would appreciate any help anyone can give.

    LB
    Lewis, Aug 20, 2003
    #1
    1. Advertising

  2. Lewis

    Lewis Guest

    DOH!

    Im concentrating too much on my code rather than the HTML Output!

    Ignaciao, as you rightly guessed I was using an image button and it also had
    an onClick event! Thanks sooo much!

    Lewis


    "Ignacio Machin" <ignacio.machin AT dot.state.fl.us> wrote in message
    news:...
    > Hi Lewis,
    >
    > I would like to see some code to bemore precise, how do you post the

    form?
    > for what you see it seems that the browser send two request to the page,
    > maybe you are calling submit twice, maybe the submit is a image button (
    > that by default make a submit ) and in the onclick you are calling a
    > function that call also form.submit therefore two submit are send to the
    > server
    > anyway I think that you should look at the code generated in the client.
    >
    > Hope this help,
    >
    > --
    > Ignacio Machin,
    > ignacio.machin AT dot.state.fl.us
    > Florida Department Of Transportation
    >
    > "Lewis" <Lewis_at_arc_dot_com> wrote in message
    > news:3f43556f$0$960$...
    > > Hi,
    > >
    > > Im having a problem with an aspx page that I'm building (and rather

    > urgently
    > > needing to complete!).
    > >
    > > Situation is this...
    > > Im transforming some XML using an XSLT which builds an HTML form using

    an
    > > aspx (C# - using VS.NET). Within the resulting HTML is a form, which
    > > contains the following :
    > > <form method="POST" action="recieveForm.aspx?lang=eng">
    > >
    > > That posts to the page 'recieveForm.aspx'.
    > > 'recieveForm.aspx' recieves the form and processes the data from the

    form
    > > elements
    > > and stores them in a database.
    > >
    > > The issue I have is that the Page_Load event (which calls my subsequent

    > data
    > > store method) gets called twice, and after further testing it appears

    all
    > > the page methods run twice.Which results in me having duplicate records
    > > within my data table.
    > >
    > > Having searched through a lot of articles in the newsgroups I can't seem

    > to
    > > find a resolution or a reason for this happening.
    > >
    > > I am not implementing AutoEventWireUp and I do not have a Handles
    > > declaration at the end of the Page_Load Method.
    > > IsPostBack is false both times the method is executed.
    > >
    > > What Im looking for is a solution and hopefully an explanation of why

    > this
    > > should happen - surely you can post an HTML form to an aspx page and

    > recieve
    > > the Headers as normal?
    > >
    > > Would appreciate any help anyone can give.
    > >
    > > LB
    > >
    > >
    > >

    >
    >
    Lewis, Aug 20, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tom Vande Stouwe MCSD.net

    Re: asp Page events execute twice after PostBack again

    Tom Vande Stouwe MCSD.net, Aug 27, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    2,439
    Daisy
    Sep 3, 2003
  2. Jarek
    Replies:
    1
    Views:
    586
    nfedin
    Aug 27, 2003
  3. Sriram Mallajyosula

    How do I post data from aspx page to another aspx page.

    Sriram Mallajyosula, Nov 5, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    956
    Steve C. Orr [MVP, MCSD]
    Nov 5, 2003
  4. =?Utf-8?B?SnVsaWE=?=
    Replies:
    4
    Views:
    749
    =?Utf-8?B?SnVsaWE=?=
    Nov 7, 2004
  5. Replies:
    6
    Views:
    4,780
    Tor Iver Wilhelmsen
    Aug 29, 2005
Loading...

Share This Page