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!

Member Avatar for LastMitch

@james19862012

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.

What platform are you using? Are you are using vbulletin or something else. The question you ask doesn't really make sense because you never explain why you need this?

Context.Identity.User.Name

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.

http://www.asp.net/web-forms/tutorials/security

I'm sorry...I'm building the site in Visual Studio 2010 using VB.

I basically just want to restrict the users who are not registered to the site (i.e. not logged in) access to a certain form (a table) that allows them to add text to the site.

I read about restricting access to certain pages (forms) using the role management but I was unable to find anything regarding access restriction for specific user controls...if that's even possible.

Hopefully that is a little bit clearer.

Did you follow up on the link I provided?

Whoops...looks like I looked past it the first time around Jorge. I'll take a look at it now. Thanks.

Member Avatar for LastMitch

@james19862012

I'm sorry...I'm building the site in Visual Studio 2010 using VB.

OK wow I'm no familiar with VB. I think the link that JorgeM provided is a good start.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.