0

I'm facing a problem which is as follows.

In my button_Click event,

Server.Transfer("~/LeaseOffer/AdSpaceDetails.aspx?Id=" + adRepo.SubmitPost(ad).ToString());

When I'm in the AdSpaceDetails.aspx Page, if I hit refresh, then the records are getting submitted again to the Database.

Even I tried cleanup of the objects like 'ad' and 'adRepo' in the finally block but in vain.

How to avoid this?

hungrycoder
  • 507
  • 2
  • 9
  • 24

1 Answers1

1

Are you updating the database before the Server.Transfer?

If you are, just change to use Response.Redirect instead of the Server.Transfer and this will fix your problem.

For more information have a look at the Post/Redirect/Get (PRG) pattern, http://en.wikipedia.org/wiki/Post/Redirect/Get

graham mendick
  • 1,839
  • 1
  • 17
  • 15