Page_Load being fired twice

Discussion in 'ASP .Net' started by =?Utf-8?B?Tmltcm9kIENvaGVu?=, May 27, 2004.

  1. Hi

    During the page_load of my Aspx page "http://myMachine/MyWebApp/Quote.aspx" , i write to the response an html that embeds a form with the action pointing out to the same aspx page
    i.e
    Response.Write( "<html><head></head><body><form action="http://myMachine/MyWebApp/Quote.aspx" name="QuoteForm" method="POST"><input type="hidden" name="response_supplier_id" value="13"/
    ...
    </form></body></html>" )

    what happens is that my page_load function is being fired twice, once with all the parameters in the Request.Form arriving as expected ( the first occurance is a POST call ), the second time i get an unwanted "GET" call with no parameters in the Request.Form

    I've checked and verified that the AutoEventWireup=false, and no event handler duplication has been introduce

    could anyone point out of this mess
     
    =?Utf-8?B?Tmltcm9kIENvaGVu?=, May 27, 2004
    #1
    1. Advertising

  2. =?Utf-8?B?Tmltcm9kIENvaGVu?=

    Nimrod cohen Guest

    Some points worth mentioning :
    1. the project itself is a webservice containing some
    webpages, amogst which, the aforementioned problematic
    page.
    2. this occurs when i'm initiating the process from an
    html which is embedded inside an e-mail item, from an
    outlook client. I have no way to test it from an http
    based client, since the server is internal, so i can't
    pass the link.

    thanks.

    >-----Original Message-----
    >Hi,
    >
    >During the page_load of my Aspx

    page "http://myMachine/MyWebApp/Quote.aspx" , i write to
    the response an html that embeds a form with the action
    pointing out to the same aspx page
    >i.e
    >Response.Write( "<html><head></head><body><form

    action="http://myMachine/MyWebApp/Quote.aspx"
    name="QuoteForm" method="POST"><input type="hidden"
    name="response_supplier_id" value="13"/>
    >....
    ></form></body></html>" );
    >
    >what happens is that my page_load function is being

    fired twice, once with all the parameters in the
    Request.Form arriving as expected ( the first occurance
    is a POST call ), the second time i get an unwanted "GET"
    call with no parameters in the Request.Form.
    >
    >I've checked and verified that the

    AutoEventWireup=false, and no event handler duplication
    has been introduced
    >
    >could anyone point out of this mess ?
    >
    >
    >
    >.
    >
     
    Nimrod cohen, May 28, 2004
    #2
    1. Advertising

  3. Hi Nimrod,

    From your description , you found one of your asp.net be loaded twice ( the
    page_load event be entered twice). Also, the second loading of the page is
    requested via "get" method , yes?

    After your second message, I'm abit confused on your detailed situation.
    But I recommend that you first isolate the web page which has the problem
    and put it into a ASP.NET web application to test rather than in a
    WebService Applicatoin. Also, as you mentioned that "you intial the process
    from a html embeded in a email, then what about the result if we simply
    request the asp.net page in browser directly?

    So simply speaking, we can first create a simple test web project and put
    the problem page in it test trough browser to see whether the problem can
    be repro. If this still can repro it, I suggest that you provide some
    detailed info on the page 's code( especially what does it render out , or
    the client html source). I've ever met a similiar issue which is caused
    that the page is referenced by it self in the output . For example, in the
    page 's ourput, it contains a image element like

    <img src="self url" >
    Then when the browser processing this element, it'll use get method to
    request the certain resource, please have a check on the above things. IF
    you have anything unclear or any other new findings, please feel free to
    post here. Thanks.

    Regards,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)

    Get Preview at ASP.NET whidbey
    http://msdn.microsoft.com/asp.net/whidbey/default.aspx
     
    Steven Cheng[MSFT], May 28, 2004
    #3
  4. =?Utf-8?B?Tmltcm9kIENvaGVu?=

    Mothish K Guest

    Hi Steven,

    I have a aspx page with five web user controls.
    The Scenario is like this,
    I get the details from the page 1(pg_entry.aspx) and server.transfer to page
    2(pg_login.aspx).
    Page 2 shows authentication and once submits,
    which inserts some value in db.
    this insertion is getting twice, coz of page_load being fired twice.
    what could be the problem.

    thanks in advace..

    Mothish K

    "Steven Cheng[MSFT]" <> wrote in message
    news:...
    > Hi Nimrod,
    >
    > From your description , you found one of your asp.net be loaded twice (

    the
    > page_load event be entered twice). Also, the second loading of the page is
    > requested via "get" method , yes?
    >
    > After your second message, I'm abit confused on your detailed situation.
    > But I recommend that you first isolate the web page which has the problem
    > and put it into a ASP.NET web application to test rather than in a
    > WebService Applicatoin. Also, as you mentioned that "you intial the

    process
    > from a html embeded in a email, then what about the result if we simply
    > request the asp.net page in browser directly?
    >
    > So simply speaking, we can first create a simple test web project and put
    > the problem page in it test trough browser to see whether the problem can
    > be repro. If this still can repro it, I suggest that you provide some
    > detailed info on the page 's code( especially what does it render out , or
    > the client html source). I've ever met a similiar issue which is caused
    > that the page is referenced by it self in the output . For example, in the
    > page 's ourput, it contains a image element like
    >
    > <img src="self url" >
    > Then when the browser processing this element, it'll use get method to
    > request the certain resource, please have a check on the above things. IF
    > you have anything unclear or any other new findings, please feel free to
    > post here. Thanks.
    >
    > Regards,
    >
    > Steven Cheng
    > Microsoft Online Support
    >
    > Get Secure! www.microsoft.com/security
    > (This posting is provided "AS IS", with no warranties, and confers no
    > rights.)
    >
    > Get Preview at ASP.NET whidbey
    > http://msdn.microsoft.com/asp.net/whidbey/default.aspx
    >
    >
    >
    >
     
    Mothish K, May 28, 2004
    #4
  5. Hi Nimrod,

    Why are you using Response.Write to dynamically render the Page content,
    especially the <form action="self url">, sine the ASP.NET's webform is by
    design support post back to self. Can you replace the Response.Write's
    output with a static aspx page template and see whether this will work? Or
    try replacing the output content with some other simple html code, as
    simple as possbile. IF the problem not occur, I think you can check the
    long html source( use binary search to see whehter there is any element
    cause the problem.)
    Thanks.


    Regards,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)

    Get Preview at ASP.NET whidbey
    http://msdn.microsoft.com/asp.net/whidbey/default.aspx
     
    Steven Cheng[MSFT], May 31, 2004
    #5
  6. Hi Nimrod,,

    Have you had a chance to check out the suggestions in my last reply or have
    you got any further ideas on this issue? If you have anything unclear or if
    there're anything else we can help, please feel free to post here. Thanks.

    Regards,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)

    Get Preview at ASP.NET whidbey
    http://msdn.microsoft.com/asp.net/whidbey/default.aspx
     
    Steven Cheng[MSFT], Jun 3, 2004
    #6
  7. =?Utf-8?B?Tmltcm9kIENvaGVu?=

    Nimrod Cohen Guest

    Hi steven,

    I cannot implement your offer, because effectivly i'm generating the
    html from an html templated ( selected from a database ) and install
    into it live data.
    and hance i cant use a pre-created ASPX file.

    further more, i have already tried to use a simple html, and the problem
    indeed, doesn't repro. but the html seems valid and i see no reason for
    this weird behaviour.

    thanks,

    Nimrod.


    *** Sent via Devdex http://www.devdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Nimrod Cohen, Jun 3, 2004
    #7
  8. Hi Nimrod,

    Thanks. for your followup. Currently I also haven't any good suggestions on
    this. But I think you can consider using some net monitor tools to have a
    track on the http messages to see what ever the second request from if you
    still feel no idea on this issue. How do you think of this? If you have any
    further concerns or ideas , please also feel free to post here.

    Regards,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)

    Get Preview at ASP.NET whidbey
    http://msdn.microsoft.com/asp.net/whidbey/default.aspx
     
    Steven Cheng[MSFT], Jun 9, 2004
    #8
    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. bminder
    Replies:
    1
    Views:
    2,196
    nfedin
    Feb 23, 2004
  2. RAJ

    PAGE_LOAD fired twice

    RAJ, Jun 8, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,964
  3. Replies:
    0
    Views:
    633
  4. Rippo
    Replies:
    1
    Views:
    524
    Scott Allen
    Aug 17, 2005
  5. rockdale
    Replies:
    1
    Views:
    685
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Nov 16, 2006
Loading...

Share This Page