Re: [aus-dotnet] ASP.NET Refresh


    [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
    • From: Rory Primrose
    • Subject: Re: [aus-dotnet] ASP.NET Refresh
    • Date: Mon, 13 Dec 2004 08:58:23 +1100

    I am about to face the same problem with my site. I was going to do
    the same thing as what Geoff has suggested, but I am going to redirect
    back to the same page which should work, instead of going to a
    different page.
    
    
    On Mon, 13 Dec 2004 07:18:11 +1100, Geoff Appleby
    <geoff.appleby@xxxxxxxxx> wrote:
    > Changing stuff on your end won't work at all, because refreshing your
    > browser page is deliberately asking the browser to resubmiot the old
    > data.
    > 
    > The best way i've found to get around this is by moving on to a
    > different page as soon as you've done your save:
    > 
    > If(Page.IsPostBack) // so here they press submit when filling out comments form
    > {
    >     Sql_Insert_Message_Stored_Procedure;
    >     Response.Redirect('someother page that looks the same, but wasn't
    > arrived at via a post');
    > }
    > 
    > --Geoff
    > 
    > On Sun, 12 Dec 2004 23:43:03 +1100, Quang Huynh
    > 
    > 
    > <geekazoid@xxxxxxxxxxxxxxx> wrote:
    > >
    > >
    > >
    > > Hi All,
    > >
    > >
    > >
    > > I'm stuck with a problem whereby I cannot for the life of me stop insertions
    > > to a database each time I refresh a page.
    > >
    > > Basically I have a .aspx page, a person enters some comments, comments go to
    > > DB, and then gets displayed on the page, behaves like a forum message I
    > > suppose.
    > >
    > >
    > >
    > > Here is what I have in my page_load:
    > >
    > >
    > >
    > > Page_Load()
    > >
    > > {
    > >
    > >             Setup_Database_Connection;
    > >
    > >             Sql_Retrieve_Messages_Stored_Procedure;
    > >
    > >             Sql_ExecuteReader_To_Display_Messages;
    > >
    > >
    > >
    > >             If(Page.IsPostBack) // so here they press submit when filling
    > > out comments form
    > >
    > >             {
    > >
    > >                         Sql_Insert_Message_Stored_Procedure;
    > >
    > >             }
    > >
    > > }
    > >
    > >
    > >
    > > It seems that each time I refresh, data is inserted, does a refresh
    > > constitute a postback?
    > >
    > > How can I overcome this problem? I've tried resetting the text boxes to
    > > String.Empty and then having a predicate so to only insert if text boxes are
    > > not empty, but it still does the insertion with the same data in memory
    > > somewhere.
    > >
    > > Tried clearing the StoredProcedure parameters.
    > >
    > >
    > >
    > > Any Ideas?
    > >
    > >
    > >
    > > Quang
    > >
    > >
    > 
    > 
    > --
    > Geoff Appleby
    > http://dotnetjunkies.com/WebLog/fredd/
    > _________________
    > You are a part of the Australian "dotnet" mailing list.
    > To unsubscribe send "unsubscribe dotnet" or to re-subscribe send "subscribe dotnet Your Name" in the body of the email to: imailsrv@xxxxxxxxxxx
    > List managed by: http://www.stanski.com
    >
    _________________
    You are a part of the Australian "dotnet" mailing list.
    To unsubscribe send "unsubscribe dotnet" or to re-subscribe send "subscribe dotnet Your Name" in the body of the email to: imailsrv@xxxxxxxxxxx
    List managed by: http://www.stanski.com
    
    



    (Click here for more information on the aus-dotnet mailling list)