tags:

views:

43

answers:

1

TempData persists for one more future request, isn't this anti REST ?

and what situations it's desired to use it ?

+3  A: 

Kind of, we us it to show messages to the user when the page is redirected. ie when a new object is created, the user is redirected to the edit page showing the new id

POST /Person/Create

Update and save the new person, get their id set message in temp data "Person Created Successfully"

Redirect to /Person/Edit/1234

This is a kind of skip though another state e.g. /Person/Created/1234

it just saves a click I suppose.

Anthony Johnston
Isn't this considered state full (against REST)?Can we redirect to /Person/Edit/1234/AfterSucess` ?
Ahmed Khalaf
I think its fair to say that dynamic data in a database is not restful, as the data has state and stored on the server not the client. So unless /Person/Edit/1234/AfterSucess could retrieve the person in the same state as it was when it was created, then it is not RESTful either
Anthony Johnston