1,105,417 Community Members

Can you restrict access to specific data controls for anonymous users?

Member Avatar
james19862012
Newbie Poster
6 posts since Nov 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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!

LastMitch
Deleted Member
 
0
 

@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?

Member Avatar
JorgeM
IT Addict
6,420 posts since Dec 2011
Reputation Points: 581 [?]
Q&As Helped to Solve: 963 [?]
Skill Endorsements: 172 [?]
Moderator
Featured
Sponsor
 
1
 

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

Member Avatar
james19862012
Newbie Poster
6 posts since Nov 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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.

Member Avatar
JorgeM
IT Addict
6,420 posts since Dec 2011
Reputation Points: 581 [?]
Q&As Helped to Solve: 963 [?]
Skill Endorsements: 172 [?]
Moderator
Featured
Sponsor
 
0
 

Did you follow up on the link I provided?

Member Avatar
james19862012
Newbie Poster
6 posts since Nov 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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

LastMitch
Deleted Member
 
0
 

@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.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: