Debug causes double postback

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?TWlrZSBMb2dhbg==?=

    Debug causes double postback

    My environment. .Net 2.0 VS2k5 SP1, IE6 (6.0.2900.2180)

    I have a web content page. The page will post back twice if I am running in
    debug mode. However if I run through the breakpoints fast enough the page
    will not post back twice.

    I have disabled Google Popup blocker, windows firewall, a soap collector
    service.

    Something wierd with IE is if I sit in debug long enough the page will go
    blank and the status bar will say something along the lines of "Looking for
    localhost".

    If I run through the breakpoints fast enough, and the blank IE page never
    shows up, then the double postback doesn't occur.

    It seems as if IE is automatically posting back if the request is taking too
    long.

    What can I do?
    --
    Mike Logan
  • =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=

    #2
    RE: Debug causes double postback

    Mike,
    It sounds to me like you either have some errant "meta - refresh" tag or
    script in the page, or you have caught some malware. For number two, get
    windows defender and run a deep scan.
    -- Peter
    Site: http://www.eggheadcafe.com
    UnBlog: http://petesbloggerama.blogspot.com
    BlogMetaFinder( BETA): http://www.blogmetafinder.com



    "Mike Logan" wrote:
    My environment. .Net 2.0 VS2k5 SP1, IE6 (6.0.2900.2180)
    >
    I have a web content page. The page will post back twice if I am running in
    debug mode. However if I run through the breakpoints fast enough the page
    will not post back twice.
    >
    I have disabled Google Popup blocker, windows firewall, a soap collector
    service.
    >
    Something wierd with IE is if I sit in debug long enough the page will go
    blank and the status bar will say something along the lines of "Looking for
    localhost".
    >
    If I run through the breakpoints fast enough, and the blank IE page never
    shows up, then the double postback doesn't occur.
    >
    It seems as if IE is automatically posting back if the request is taking too
    long.
    >
    What can I do?
    --
    Mike Logan

    Comment

    • Steven Cheng[MSFT]

      #3
      RE: Debug causes double postback

      Hi Mike,

      Based on your description, I think the double postback issue is actually
      occuring when your server-side code will block/wait for a while rather than
      execute immediately, so the "under debugging mode" is only a condition
      which trigger this cause.

      For ASP.NET web page double postback, I've also met some similar issues
      before and here are some of the causes:

      ** Some html markup (such as the meta fresh tag or a <imgor css image
      style ) that point to the page itself which cause an additional get postback

      ** certain server-side event handler be registered twice(usually in vb.net
      web page)

      ** some control may cause postback event be submit twice(the SubmitButton
      which configured as image style...)

      for your scenario, I think one possible cause is your page's response will
      write out some certain html tag that cause a new request to the page
      itself. Since it will occur when you wait a while at server-side(such as
      break at debugger), maybe at that time, the markup is send back to client
      and the browser send a new request). You can check the following things to
      further verify the behavior:

      1) Check IIS log on the server and see what kind of request is the second
      duplicated one(get or post)

      2) Check whether all the page events are executed twice or only the
      particular postback event

      If you have any other finding, please also feel free to post here.

      Sincerely,

      Steven Cheng

      Microsoft MSDN Online Support Lead



      =============== =============== =============== =====

      Get notification to my posts through email? Please refer to
      Gain technical skills through documentation and training, earn certifications and connect with the community

      ications.



      Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
      where an initial response from the community or a Microsoft Support
      Engineer within 1 business day is acceptable. Please note that each follow
      up response may take approximately 2 business days as the support
      professional working with you may need further investigation to reach the
      most efficient resolution. The offering is not appropriate for situations
      that require urgent, real-time or phone-based interactions or complex
      project analysis and dump analysis issues. Issues of this nature are best
      handled working with a dedicated Microsoft Support Engineer by contacting
      Microsoft Customer Support Services (CSS) at
      http://msdn.microsoft.com/subscripti...t/default.aspx.

      =============== =============== =============== =====


      This posting is provided "AS IS" with no warranties, and confers no rights.





      Comment

      • =?Utf-8?B?TWlrZSBMb2dhbg==?=

        #4
        RE: Debug causes double postback

        Hello Steven,

        I checked the IIS logs. Here is what I saw in the first pass:

        10:06:45 127.0.0.1 GET /Application1/Page1.aspx 401
        10:06:54 127.0.0.1 GET /Application1/Page1.aspx 200
        10:06:57 127.0.0.1 POST /FormService/FormService.asm x 200
        10:07:03 127.0.0.1 GET /css/css1.css 404
        10:07:03 127.0.0.1 GET /Application1/Page1.aspx 200
        10:07:07 127.0.0.1 DEBUG /Application1/NewForm.aspx 200

        I saw the 404 for the CSS file, I know where it is occurring...rem oving it
        from the page. Tried again and go this.

        10:37:01 127.0.0.1 GET /Application1/Page1.aspx 401
        10:37:07 127.0.0.1 GET /Application1/Page1.aspx 200
        10:37:11 127.0.0.1 POST /TestService/TestService.asm x 200
        10:37:18 127.0.0.1 GET
        /Application1/PetersDatePacka ge/Appearance/stylesheet1.css 401
        10:37:18 127.0.0.1 GET
        /Application1/PetersDatePacka ge/Appearance/stylesheet1.css 304
        10:37:18 127.0.0.1 GET /Application1/Page1.aspx 200
        10:37:18 127.0.0.1 GET /Application1/PetersDatePacka ge/1_1_12/PDP_Globals.js
        304
        10:37:18 127.0.0.1 GET /Application1/PetersDatePacka ge/1_1_12/DateTextBox.js
        304
        10:37:18 127.0.0.1 GET /Application1/PetersDatePacka ge/1_1_12/CSCalendar.js
        304
        10:37:18 127.0.0.1 GET
        /Application1/PetersDatePacka ge/1_1_12/CSMonthPicker.j s 304
        10:37:18 127.0.0.1 GET /Application1/PetersDatePacka ge/1_1_12/CS_Menu.js 304


        If I run through fast enough on the page, the page load event is only fired
        once. However it seems like if I don't get my debugging done before the IE
        screen goes blank and the status bar changes to the "searching for localhost"
        then the page load event is hit twice.

        When you say Page Events....do you mean true page events like Init Load,
        Render?

        Also, just as an fyi, I am registering to a published event on a web
        control. The web control has buttons on it and I am doing the processing for
        them on the hosting page. Code is below.

        Private Sub Page1_Init(ByVa l sender As Object, ByVal e As System.EventArg s)
        Handles Me.Init
        AddHandler WebControl1.Act ionClickEvent, AddressOf OnFormAction
        End Sub



        --
        Mike Logan


        "Steven Cheng[MSFT]" wrote:
        Hi Mike,
        >
        Based on your description, I think the double postback issue is actually
        occuring when your server-side code will block/wait for a while rather than
        execute immediately, so the "under debugging mode" is only a condition
        which trigger this cause.
        >
        For ASP.NET web page double postback, I've also met some similar issues
        before and here are some of the causes:
        >
        ** Some html markup (such as the meta fresh tag or a <imgor css image
        style ) that point to the page itself which cause an additional get postback
        >
        ** certain server-side event handler be registered twice(usually in vb.net
        web page)
        >
        ** some control may cause postback event be submit twice(the SubmitButton
        which configured as image style...)
        >
        for your scenario, I think one possible cause is your page's response will
        write out some certain html tag that cause a new request to the page
        itself. Since it will occur when you wait a while at server-side(such as
        break at debugger), maybe at that time, the markup is send back to client
        and the browser send a new request). You can check the following things to
        further verify the behavior:
        >
        1) Check IIS log on the server and see what kind of request is the second
        duplicated one(get or post)
        >
        2) Check whether all the page events are executed twice or only the
        particular postback event
        >
        If you have any other finding, please also feel free to post here.
        >
        Sincerely,
        >
        Steven Cheng
        >
        Microsoft MSDN Online Support Lead
        >
        >
        >
        =============== =============== =============== =====
        >
        Get notification to my posts through email? Please refer to
        Gain technical skills through documentation and training, earn certifications and connect with the community

        ications.
        >
        >
        >
        Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
        where an initial response from the community or a Microsoft Support
        Engineer within 1 business day is acceptable. Please note that each follow
        up response may take approximately 2 business days as the support
        professional working with you may need further investigation to reach the
        most efficient resolution. The offering is not appropriate for situations
        that require urgent, real-time or phone-based interactions or complex
        project analysis and dump analysis issues. Issues of this nature are best
        handled working with a dedicated Microsoft Support Engineer by contacting
        Microsoft Customer Support Services (CSS) at
        http://msdn.microsoft.com/subscripti...t/default.aspx.
        >
        =============== =============== =============== =====
        >
        >
        This posting is provided "AS IS" with no warranties, and confers no rights.
        >
        >
        >
        >
        >
        >

        Comment

        • =?Utf-8?B?TWlrZSBMb2dhbg==?=

          #5
          RE: Debug causes double postback

          Hello Peter,

          I checked for meta-refresh tags but there where none.
          --
          Mike Logan


          "Peter Bromberg [C# MVP]" wrote:
          Mike,
          It sounds to me like you either have some errant "meta - refresh" tag or
          script in the page, or you have caught some malware. For number two, get
          windows defender and run a deep scan.
          -- Peter
          Site: http://www.eggheadcafe.com
          UnBlog: http://petesbloggerama.blogspot.com
          BlogMetaFinder( BETA): http://www.blogmetafinder.com
          >
          >
          >
          "Mike Logan" wrote:
          >
          My environment. .Net 2.0 VS2k5 SP1, IE6 (6.0.2900.2180)

          I have a web content page. The page will post back twice if I am running in
          debug mode. However if I run through the breakpoints fast enough the page
          will not post back twice.

          I have disabled Google Popup blocker, windows firewall, a soap collector
          service.

          Something wierd with IE is if I sit in debug long enough the page will go
          blank and the status bar will say something along the lines of "Looking for
          localhost".

          If I run through the breakpoints fast enough, and the blank IE page never
          shows up, then the double postback doesn't occur.

          It seems as if IE is automatically posting back if the request is taking too
          long.

          What can I do?
          --
          Mike Logan

          Comment

          • =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=

            #6
            RE: Debug causes double postback

            You could possibly have "AutoEventWireU p="true" in your ASPX @Page
            declaration, plus a specific additional event handler defined. Remove the
            "AutoeventWireu p" if present and test your page.
            -- Peter
            Site: http://www.eggheadcafe.com
            UnBlog: http://petesbloggerama.blogspot.com
            BlogMetaFinder( BETA): http://www.blogmetafinder.com



            "Mike Logan" wrote:
            My environment. .Net 2.0 VS2k5 SP1, IE6 (6.0.2900.2180)
            >
            I have a web content page. The page will post back twice if I am running in
            debug mode. However if I run through the breakpoints fast enough the page
            will not post back twice.
            >
            I have disabled Google Popup blocker, windows firewall, a soap collector
            service.
            >
            Something wierd with IE is if I sit in debug long enough the page will go
            blank and the status bar will say something along the lines of "Looking for
            localhost".
            >
            If I run through the breakpoints fast enough, and the blank IE page never
            shows up, then the double postback doesn't occur.
            >
            It seems as if IE is automatically posting back if the request is taking too
            long.
            >
            What can I do?
            --
            Mike Logan

            Comment

            • Steven Cheng[MSFT]

              #7
              RE: Debug causes double postback

              Thanks for your reply Mike,

              so "Page1.aspx " is the one in problem, right? From the log you provided,
              there are only multiple "get" requests, so the double "Page_load" occurs
              at the first load of the page?

              Yes, the page events I mentioned earlier means those standard built-in Page
              events(Init, Load, Prerender....).

              I'm still quite interested in the "browser turn to blank behavior", not
              sure whether it is caused by client-side browser or some html element
              flushed from server-side. I'd like to perform some test on my local side,
              if the problem does be caused by some element flushed by server-side page,
              it should be reproable on my side. Would you try make a simplified page
              that can repro the problem and send it to me? You can reach me through the
              email in my signature(remov e "online" in it).

              Looking forward to your reply.

              Sincerely,

              Steven Cheng

              Microsoft MSDN Online Support Lead


              This posting is provided "AS IS" with no warranties, and confers no rights.



              Comment

              • Steven Cheng[MSFT]

                #8
                RE: Debug causes double postback

                Hi Mike,

                Have you got any further progress on this issue? If there is still
                anything need help, please don't hesitate to post here.

                Sincerely,

                Steven Cheng

                Microsoft MSDN Online Support Lead

                This posting is provided "AS IS" with no warranties, and confers no rights.

                Comment

                Working...