Hi all,

How can I allow a user to modify his added comment within 30 minutes.

I mean by that, I'm allowing a user to pot a comment. This user may want to modify his comment. I, as administrator, need to allow this user to modify his comment if and only if his comment age is less than or equal 30 minutes.

Which method should I use?

Thanks in advance.

I am assuming this is ASP.net question. I am further assuming that user enters comment and submits page. At this point, alongwith the comment, you would save time of entry.

Now there is another action (like click of button) user will perform in order to edit the comment. On click of that, on server side, you can check if it is already 30 min or less.

Same way, again on save of edited comment, you might want to check if change was submitted within 30 min from original request. You might not want to check (it depends on your requirements). For ex. if user asks edit on 28th min and doesn't submit till 32nd min. You might want to reset time stamp as well (again upto your requirements).

One can always use javascript, sending time of creation as hidden variable and start timer on load of page that will disable edit button after 30 min. The problem could be in time-zones. Like server is in California where your record added is in West-coast time. User is in New york. Half hr is already gone from your browser-to-server setting.

If this meets your requirements, glad I helped. Otherwise post what is missing (like "as admin" you mean soft coding 30min, you can use web.config or database etc)