Pregunta

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?

¿Fue útil?

Solución

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top