Click here to Skip to main content
15,891,473 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi all ,

I have a comment functionality on my website and i want only logged in users to comment on it so how can i do it ? I already know how to deny access to pages so is it done in the same way ?

Thanks in advance.
Posted

1 solution

you can use sessions for this purpose. store the user id in session when a user logged in and delete it when he logged out.
put your comment control in a panel and by default set its visibility hidden. In your page which contain the comments control just check in the page load if session is not null turn visibility visible. otherwise it remains hidden.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900