As the title hopefully made clear...I want to restrict the access of a user data control so anonymous users (ones who havent registered with my site) can't access its contents.
I read about restricting access to specific roles and I understand how it works for specific pages (forms) but I was unable to find anything about denying access to a specific control on a page.
Here's the scenario...on my Default.aspx page I have a linkbutton that once clicked will make a table in a placeholder visible. Inside this table are 2 text boxes and a button that I only want accessible to users who have registered. Everything else on the site I want accessible to anonymous as well as registered users.
This is just coming off the top of my head and I don't even know if this is remotely close to correct but since you can use the Context.Identity.User.Name (I think that's correct) to show the name of the specific user...is there something like Context.Identity.User.Role = "Anonymous" where I could throw in a loop to restrict access?
Anything you guys can provide is greatly appreciated! Thanks!
This is generally used for intranet web sites where you enable Windows authentication on the website in IIS. This allows you to grab the user identity (user credentials used when loggin on to the computer).
If this is a public facing website, this isnt going to be useful for you. You can build a simple login component and store the user name in a session variable and also the user's role.
You may want to check out the security modules on the asp.net website. There are quite a bit of built in classes you can leverage and integrate into your application. Makes things a bit easier, or more difficult if you are not an avid asp.net developer.