The correct way to do this with asp.net-mvc? list of item comments

you have information about an item and you got a list of comments for that item

how would you manage add / remove / edit using route?

now i have this:

/item/details/7/editcomment/1
/item/details/7/delcomment/1
/item/details/7/addcomment

      

is this the correct way?

0


a source to share


3 answers


  • / comment / edit / {CommentID}
  • / comment / delete / {CommentID}
  • / comment / add / {Itemid}


+4


a source


I suggest removing the "details":



/ item / 7 / editcomment / 1 / clause /
7 / delcomment / 1
/ clause / 7 / AddComment

+1


a source


I would like to point out that for security reasons you prefer not to use this approach to delete items. Always use POST to perform any modification action. Otherwise, someone might try to abuse the system by inserting an image with a link to delete.

Of course, if you just redirect users to the confirmation page and they need to click the submit button to start the operation, that will be fine.

More on Stephen Walter's blog:

ASP.NET MVC Tip # 46 - Don't use Delete Links because they create security holes

0


a source







All Articles