Help, the simplest code doesn't work well, but where is the problem?

Discussion in 'ASP .Net' started by Quentin Huo, Oct 4, 2004.

  1. Quentin Huo

    Quentin Huo Guest

    Hi:

    When I tried the following code, I got an error:

    if I clicked "Click me" button more than one time, and than click "back"
    button in the IE browser Toolbar, I will get an error: "The page cannot be
    displayed......".

    But I won't get any error if I only click the "click me" button one time and
    then click the browser's "Back" button.

    In fact, this is an example from the Book "Essential ASP.NET with Examples
    in C#" by Fritz Onion ( Listing 2-5). Please try this simplest code and tell
    me if you get the same problem. What causes the problem? Maybe it is caused
    by webserver setting?

    Can anyone help me!

    Q.

    -----------------------------------------------------------------
    <%@ Page Language="C#" %>

    <html>
    <script runat=server>
    protected void OnClickMyButton(object src, EventArgs e)
    {
    _message.InnerText = "You clicked the button!";
    }

    protected void Page_Init(object src, EventArgs e)
    {
    _MyButton.ServerClick +=
    new EventHandler(OnClickMyButton);
    }
    </script>
    <body>
    <form runat=server>

    <h2>ASP.NET event page</h2>
    <p>
    <input type=button id=_MyButton
    value="Click me!" runat=server />
    </p>
    <span id=_message runat=server/>
    </form>
    </body>
    </html>
    -----------------------------------------------------------------
     
    Quentin Huo, Oct 4, 2004
    #1
    1. Advertising

  2. The page is set to time out most likely. You should not be able to use the
    back button on a form. There are nicer ways of telling the user, however.
    Have not seen this particular book.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    *************************************************
    Think outside the box!
    *************************************************
    "Quentin Huo" <> wrote in message
    news:...
    > Hi:
    >
    > When I tried the following code, I got an error:
    >
    > if I clicked "Click me" button more than one time, and than click "back"
    > button in the IE browser Toolbar, I will get an error: "The page cannot be
    > displayed......".
    >
    > But I won't get any error if I only click the "click me" button one time
    > and then click the browser's "Back" button.
    >
    > In fact, this is an example from the Book "Essential ASP.NET with Examples
    > in C#" by Fritz Onion ( Listing 2-5). Please try this simplest code and
    > tell me if you get the same problem. What causes the problem? Maybe it is
    > caused by webserver setting?
    >
    > Can anyone help me!
    >
    > Q.
    >
    > -----------------------------------------------------------------
    > <%@ Page Language="C#" %>
    >
    > <html>
    > <script runat=server>
    > protected void OnClickMyButton(object src, EventArgs e)
    > {
    > _message.InnerText = "You clicked the button!";
    > }
    >
    > protected void Page_Init(object src, EventArgs e)
    > {
    > _MyButton.ServerClick +=
    > new EventHandler(OnClickMyButton);
    > }
    > </script>
    > <body>
    > <form runat=server>
    >
    > <h2>ASP.NET event page</h2>
    > <p>
    > <input type=button id=_MyButton
    > value="Click me!" runat=server />
    > </p>
    > <span id=_message runat=server/>
    > </form>
    > </body>
    > </html>
    > -----------------------------------------------------------------
    >
    >
    >
    >
    >
    >
    >
    >
    >
     
    Cowboy \(Gregory A. Beamer\), Oct 5, 2004
    #2
    1. Advertising

  3. Quentin Huo

    Quentin Huo Guest

    Hi:

    Thank you!

    I tried the same code in another machine, it works! No matter how many the
    click times are, I can click "Back" button of the browser without getting
    any error. So I think it should be a configuration issue.

    And I checked the web.config file and the value of "timeout" in
    <sessionState> is "20".

    Where is the problem? Where can I check?

    Qing


    "Cowboy (Gregory A. Beamer)" <> wrote in
    message news:...
    > The page is set to time out most likely. You should not be able to use the
    > back button on a form. There are nicer ways of telling the user, however.
    > Have not seen this particular book.
    >
    > --
    > Gregory A. Beamer
    > MVP; MCP: +I, SE, SD, DBA
    >
    > *************************************************
    > Think outside the box!
    > *************************************************
    > "Quentin Huo" <> wrote in message
    > news:...
    >> Hi:
    >>
    >> When I tried the following code, I got an error:
    >>
    >> if I clicked "Click me" button more than one time, and than click "back"
    >> button in the IE browser Toolbar, I will get an error: "The page cannot
    >> be displayed......".
    >>
    >> But I won't get any error if I only click the "click me" button one time
    >> and then click the browser's "Back" button.
    >>
    >> In fact, this is an example from the Book "Essential ASP.NET with
    >> Examples in C#" by Fritz Onion ( Listing 2-5). Please try this simplest
    >> code and tell me if you get the same problem. What causes the problem?
    >> Maybe it is caused by webserver setting?
    >>
    >> Can anyone help me!
    >>
    >> Q.
    >>
    >> -----------------------------------------------------------------
    >> <%@ Page Language="C#" %>
    >>
    >> <html>
    >> <script runat=server>
    >> protected void OnClickMyButton(object src, EventArgs e)
    >> {
    >> _message.InnerText = "You clicked the button!";
    >> }
    >>
    >> protected void Page_Init(object src, EventArgs e)
    >> {
    >> _MyButton.ServerClick +=
    >> new EventHandler(OnClickMyButton);
    >> }
    >> </script>
    >> <body>
    >> <form runat=server>
    >>
    >> <h2>ASP.NET event page</h2>
    >> <p>
    >> <input type=button id=_MyButton
    >> value="Click me!" runat=server />
    >> </p>
    >> <span id=_message runat=server/>
    >> </form>
    >> </body>
    >> </html>
    >> -----------------------------------------------------------------
    >>
    >>
    >>
    >>
    >>
    >>
    >>
    >>
    >>

    >
    >
     
    Quentin Huo, Oct 5, 2004
    #3
  4. Quentin Huo

    Patrice Guest

    It looks more like a client side issue as you have a different effect on two
    machines. Check perhaps the "cache settings" in IE.

    Patrice

    --

    "Quentin Huo" <> a écrit dans le message de
    news:...
    > Hi:
    >
    > Thank you!
    >
    > I tried the same code in another machine, it works! No matter how many the
    > click times are, I can click "Back" button of the browser without getting
    > any error. So I think it should be a configuration issue.
    >
    > And I checked the web.config file and the value of "timeout" in
    > <sessionState> is "20".
    >
    > Where is the problem? Where can I check?
    >
    > Qing
    >
    >
    > "Cowboy (Gregory A. Beamer)" <> wrote in
    > message news:...
    > > The page is set to time out most likely. You should not be able to use

    the
    > > back button on a form. There are nicer ways of telling the user,

    however.
    > > Have not seen this particular book.
    > >
    > > --
    > > Gregory A. Beamer
    > > MVP; MCP: +I, SE, SD, DBA
    > >
    > > *************************************************
    > > Think outside the box!
    > > *************************************************
    > > "Quentin Huo" <> wrote in message
    > > news:...
    > >> Hi:
    > >>
    > >> When I tried the following code, I got an error:
    > >>
    > >> if I clicked "Click me" button more than one time, and than click

    "back"
    > >> button in the IE browser Toolbar, I will get an error: "The page cannot
    > >> be displayed......".
    > >>
    > >> But I won't get any error if I only click the "click me" button one

    time
    > >> and then click the browser's "Back" button.
    > >>
    > >> In fact, this is an example from the Book "Essential ASP.NET with
    > >> Examples in C#" by Fritz Onion ( Listing 2-5). Please try this simplest
    > >> code and tell me if you get the same problem. What causes the problem?
    > >> Maybe it is caused by webserver setting?
    > >>
    > >> Can anyone help me!
    > >>
    > >> Q.
    > >>
    > >> -----------------------------------------------------------------
    > >> <%@ Page Language="C#" %>
    > >>
    > >> <html>
    > >> <script runat=server>
    > >> protected void OnClickMyButton(object src, EventArgs e)
    > >> {
    > >> _message.InnerText = "You clicked the button!";
    > >> }
    > >>
    > >> protected void Page_Init(object src, EventArgs e)
    > >> {
    > >> _MyButton.ServerClick +=
    > >> new EventHandler(OnClickMyButton);
    > >> }
    > >> </script>
    > >> <body>
    > >> <form runat=server>
    > >>
    > >> <h2>ASP.NET event page</h2>
    > >> <p>
    > >> <input type=button id=_MyButton
    > >> value="Click me!" runat=server />
    > >> </p>
    > >> <span id=_message runat=server/>
    > >> </form>
    > >> </body>
    > >> </html>
    > >> -----------------------------------------------------------------
    > >>
    > >>
    > >>
    > >>
    > >>
    > >>
    > >>
    > >>
    > >>

    > >
    > >

    >
    >
     
    Patrice, Oct 5, 2004
    #4
    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. yaya9

    xml tag doesn't work well

    yaya9, Mar 7, 2004, in forum: XML
    Replies:
    0
    Views:
    358
    yaya9
    Mar 7, 2004
  2. cylin
    Replies:
    13
    Views:
    5,813
    Larry Brasfield
    Oct 24, 2004
  3. alexrait1
    Replies:
    3
    Views:
    471
    Steven Bethard
    Mar 9, 2005
  4. cylin

    rand() function doesn't work well??

    cylin, Oct 22, 2004, in forum: C Programming
    Replies:
    15
    Views:
    823
    Merrill & Michele
    Oct 24, 2004
  5. BlackjadeLin
    Replies:
    2
    Views:
    1,178
    BlackjadeLin
    Jan 13, 2008
Loading...

Share This Page