Refreshing the page after posting issue

  • Thread starter Thread starter -Karl
  • Start date Start date
K

-Karl

Apparently, asp.net has a posting issue with refreshing. There seems
to be several solutions to the issue but I was wondering if there is a
final workaround for the issue?

If so, can you please inform me what I need to do?
I'm using ASP.NET 2.0 beta
 
-Karl said:
Apparently, asp.net has a posting issue with refreshing. There seems
to be several solutions to the issue but I was wondering if there is a
final workaround for the issue?

If so, can you please inform me what I need to do?
I'm using ASP.NET 2.0 beta

Can you please tell us what you're talking about? "a posting issue with
refreshing" is pretty vague.

John Saunders
 
Simple. You have a form. You fill out the form. You submit the form.
You refresh the page and see another submition.

In my case, I am trying to insert some data. Refrshing the page after
submitting the data results in duplicate data being entered. This
happens with any type of form submition. The action gets refreshed. I
need to know how to prevent this from happening.

I could code in major checks when submitting the form but that seems
rather overkill on coding. Surely there is a simplier method?
 
Have you found an answer to this? I'm having a similar problem. I noticed
that when the user clicks a button (Save for instance), and then clicks the
"Refresh" button on the browser, the onClick event handler for my "Save"
button gets kicked off again! I think this is similar to the issue you're
having, correct? I thought asp.net was supposed to be stateless in that it
wasn't supposed to remember what "action" (i.e. onClick event) you did last.
It should just refresh and hit the Page_Load event handler again where you
can check for a postback. Any help would be appreciated if you've got any
further understanding.
 
No, no one seems to want to post the solution and the web doesn't have
any solutions.

While it' annoying and sometimes dangerous, I have become used to the
issue for now but I can not design any pages for production like this
or else I'll have major issues,
 
Have you found an answer to this? I'm having a similar problem. I noticed
that when the user clicks a button (Save for instance), and then clicks the
"Refresh" button on the browser, the onClick event handler for my "Save"
button gets kicked off again! I think this is similar to the issue you're
having, correct? I thought asp.net was supposed to be stateless in that it
wasn't supposed to remember what "action" (i.e. onClick event) you did last.
It should just refresh and hit the Page_Load event handler again where you
can check for a postback. Any help would be appreciated if you've got any
further understanding.

OK, simple.

Redirect to a completion page after data has been stored and confirmed.

If you like, you can send querystring parameters with the data to this page
and display them, or the page can say, simply: "Thank you."

Anyway, no danger of refresh reloading data.

You might also consider using constraints in your database to prevent
duplicates.

-- ipgrunt
 
Under normal circumstances, that would be ok. However, in my case, the
form and results are on the same page. I guess I could redirect them
to another page which would then redirect them BACK to the form /
result page. I was thinking there was an simplier method

With the constraints, the only way I know of checking for duplicates is
to perform a Select query to see if there are any duplicates in the DB.
But isn't there a simplier way to verify there is no entry?

Thanks!
 
Under normal circumstances, that would be ok. However, in my case, the
form and results are on the same page. I guess I could redirect them
to another page which would then redirect them BACK to the form /
result page. I was thinking there was an simplier method

With the constraints, the only way I know of checking for duplicates is
to perform a Select query to see if there are any duplicates in the DB.
But isn't there a simplier way to verify there is no entry?

Thanks!

Well yes, you use a database constraint. In SqlServer it's called a UNIQUE
constraint.

Primary keys are by definition UNIQUE constraints. You can also apply UNIQUE
constraints to other columns or sets of columns (take care with this, as you
build BIG indices this way).

If you use, for example, an email addresses as a primary key, and then try to
insert a record containing an email that's already in the index, the db will
cry foul.

-- ipgrunt
 
mmmm... interesting approach. One that I never thought to look at.
I'd have to see how to catch the error and be able to inform the user
the record already exists.... But this is a start, thanks!
 
Back
Top