Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. Clever Code
  4. Return of the double postback bug

Return of the double postback bug

Scheduled Pinned Locked Moved Clever Code
csharphelphtmlasp-netsysadmin
13 Posts 5 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    leppie
    wrote on last edited by
    #1

    Many of you know this bug from ASP.NET 1.x. They said they fixed it, but for some reason we were hitting the same issue on a page with ASP.NET 2.0. After a long and hard search I found something like this:

    <%@ Page Language="C#" AutoEventWireup="true" %>

    <script runat="server" type="text/C#">
    void Page_Load(object sender, EventArgs e)
    {
    System.Diagnostics.Trace.WriteLine("Postback!");
    }
    </script>

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>Untitled Page</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <img src="" />
    </div>
    </form>
    </body>
    </html>

    Note the IMG element with the empty S

    D M S 3 Replies Last reply
    0
    • L leppie

      Many of you know this bug from ASP.NET 1.x. They said they fixed it, but for some reason we were hitting the same issue on a page with ASP.NET 2.0. After a long and hard search I found something like this:

      <%@ Page Language="C#" AutoEventWireup="true" %>

      <script runat="server" type="text/C#">
      void Page_Load(object sender, EventArgs e)
      {
      System.Diagnostics.Trace.WriteLine("Postback!");
      }
      </script>

      <html xmlns="http://www.w3.org/1999/xhtml" >
      <head runat="server">
      <title>Untitled Page</title>
      </head>
      <body>
      <form id="form1" runat="server">
      <div>
      <img src="" />
      </div>
      </form>
      </body>
      </html>

      Note the IMG element with the empty S

      D Offline
      D Offline
      DavidNohejl
      wrote on last edited by
      #2

      leppie wrote:

      IMG element with the empty SRC attribute

      Ha! It does request on the same page?


      "Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe

      L 1 Reply Last reply
      0
      • D DavidNohejl

        leppie wrote:

        IMG element with the empty SRC attribute

        Ha! It does request on the same page?


        "Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe

        L Offline
        L Offline
        leppie
        wrote on last edited by
        #3

        Yes :( In both IE and FF...

        **

        xacc.ide-0.2.0.57 - now with C# 2.0 parser and seamless VS2005 solution support!

        **

        1 Reply Last reply
        0
        • L leppie

          Many of you know this bug from ASP.NET 1.x. They said they fixed it, but for some reason we were hitting the same issue on a page with ASP.NET 2.0. After a long and hard search I found something like this:

          <%@ Page Language="C#" AutoEventWireup="true" %>

          <script runat="server" type="text/C#">
          void Page_Load(object sender, EventArgs e)
          {
          System.Diagnostics.Trace.WriteLine("Postback!");
          }
          </script>

          <html xmlns="http://www.w3.org/1999/xhtml" >
          <head runat="server">
          <title>Untitled Page</title>
          </head>
          <body>
          <form id="form1" runat="server">
          <div>
          <img src="" />
          </div>
          </form>
          </body>
          </html>

          Note the IMG element with the empty S

          M Offline
          M Offline
          Mike Dimmick
          wrote on last edited by
          #4

          Is this the default page? Specifying src="" means that it will simply reuse the page URL's base folder, i.e. it's a relative URL with no relative part. You'll get one run of the page for anything on the page with an empty URL. If it's not the default page the default page will be run instead. This is entirely according to the HTML spec and has nothing to do with ASP.NET.

          Stability. What an interesting concept. -- Chris Maunder

          L 1 Reply Last reply
          0
          • M Mike Dimmick

            Is this the default page? Specifying src="" means that it will simply reuse the page URL's base folder, i.e. it's a relative URL with no relative part. You'll get one run of the page for anything on the page with an empty URL. If it's not the default page the default page will be run instead. This is entirely according to the HTML spec and has nothing to do with ASP.NET.

            Stability. What an interesting concept. -- Chris Maunder

            L Offline
            L Offline
            leppie
            wrote on last edited by
            #5

            It can be any page! (there might be a difference between IE and FF here) The point is, it was a subtle bug :p

            **

            xacc.ide-0.2.0.57 - now with C# 2.0 parser and seamless VS2005 solution support!

            **

            1 Reply Last reply
            0
            • L leppie

              Many of you know this bug from ASP.NET 1.x. They said they fixed it, but for some reason we were hitting the same issue on a page with ASP.NET 2.0. After a long and hard search I found something like this:

              <%@ Page Language="C#" AutoEventWireup="true" %>

              <script runat="server" type="text/C#">
              void Page_Load(object sender, EventArgs e)
              {
              System.Diagnostics.Trace.WriteLine("Postback!");
              }
              </script>

              <html xmlns="http://www.w3.org/1999/xhtml" >
              <head runat="server">
              <title>Untitled Page</title>
              </head>
              <body>
              <form id="form1" runat="server">
              <div>
              <img src="" />
              </div>
              </form>
              </body>
              </html>

              Note the IMG element with the empty S

              S Offline
              S Offline
              S Douglas
              wrote on last edited by
              #6

              Hey leppie, what are you using for colorizing source code?


              L J 2 Replies Last reply
              0
              • S S Douglas

                Hey leppie, what are you using for colorizing source code?


                L Offline
                L Offline
                leppie
                wrote on last edited by
                #7

                My own IDE of course :p

                **

                xacc.ide-0.2.0.57 - now with C# 2.0 parser and seamless VS2005 solution support!

                **

                S 1 Reply Last reply
                0
                • L leppie

                  My own IDE of course :p

                  **

                  xacc.ide-0.2.0.57 - now with C# 2.0 parser and seamless VS2005 solution support!

                  **

                  S Offline
                  S Offline
                  S Douglas
                  wrote on last edited by
                  #8

                  leppie wrote:

                  My own IDE of course

                  Sweet! It's to bad it doesnt do C++


                  L 2 Replies Last reply
                  0
                  • S S Douglas

                    leppie wrote:

                    My own IDE of course

                    Sweet! It's to bad it doesnt do C++


                    L Offline
                    L Offline
                    leppie
                    wrote on last edited by
                    #9

                    It does do basic C++, nothing as pretty as the C# support :p

                    **

                    xacc.ide-0.2.0.57 - now with C# 2.0 parser and seamless VS2005 solution support!

                    **

                    S 1 Reply Last reply
                    0
                    • S S Douglas

                      leppie wrote:

                      My own IDE of course

                      Sweet! It's to bad it doesnt do C++


                      L Offline
                      L Offline
                      leppie
                      wrote on last edited by
                      #10

                      http://userfiles.wdevs.com/leppie/xacc.cpp.png[^] There's a sample :p Just hightlight the text (duh), and do copy to HTML, and it will have the code ready to be pasted in CP :p Most browserbased editor picks up on the normal copy, and no need to go via 'copy to HTML', also works well in Word :p

                      **

                      xacc.ide-0.2.0.57 - now with C# 2.0 parser and seamless VS2005 solution support!

                      **

                      1 Reply Last reply
                      0
                      • L leppie

                        It does do basic C++, nothing as pretty as the C# support :p

                        **

                        xacc.ide-0.2.0.57 - now with C# 2.0 parser and seamless VS2005 solution support!

                        **

                        S Offline
                        S Offline
                        S Douglas
                        wrote on last edited by
                        #11

                        leppie wrote:

                        It does do basic C++,

                        Downloading for testing purposes. :)


                        1 Reply Last reply
                        0
                        • S S Douglas

                          Hey leppie, what are you using for colorizing source code?


                          J Offline
                          J Offline
                          Jon Sagara
                          wrote on last edited by
                          #12

                          You can also use CopySourceAsHtml[^]. Ex:

                          [StructLayoutAttribute(LayoutKind.Sequential)]

                          public struct SystemTime

                          {

                          public short year;

                          public short month;

                          public short dayOfWeek;

                          public short day;

                          public short hour;

                          public short minute;

                          public short second;

                          public short milliseconds;

                          }

                          Edit: Although I don't think CSAH will do the ASPX page. I *think* it will only work on .cs pages.

                          Jon Sagara This is the stuff we'll drink on special occasions. To paraphrase my father-in-law, this is the kind of wine that results in kids. -- A friend Blog | Site | Articles

                          L 1 Reply Last reply
                          0
                          • J Jon Sagara

                            You can also use CopySourceAsHtml[^]. Ex:

                            [StructLayoutAttribute(LayoutKind.Sequential)]

                            public struct SystemTime

                            {

                            public short year;

                            public short month;

                            public short dayOfWeek;

                            public short day;

                            public short hour;

                            public short minute;

                            public short second;

                            public short milliseconds;

                            }

                            Edit: Although I don't think CSAH will do the ASPX page. I *think* it will only work on .cs pages.

                            Jon Sagara This is the stuff we'll drink on special occasions. To paraphrase my father-in-law, this is the kind of wine that results in kids. -- A friend Blog | Site | Articles

                            L Offline
                            L Offline
                            leppie
                            wrote on last edited by
                            #13

                            Hmmm, I like the border, but I still prefer my 'rendering' :p

                            [StructLayoutAttribute(LayoutKind.Sequential)]
                            public struct SystemTime
                            {
                            public short year;
                            public short month;
                            public short dayOfWeek;
                            public short day;
                            public short hour;
                            public short minute;
                            public short second;
                            public short milliseconds;
                            }

                            **

                            xacc.ide-0.2.0.57 - now with C# 2.0 parser and seamless VS2005 solution support!

                            **

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups