Hi masters, I created a folder in my site and it's called "admin". And I added the forms about administrating into this folder. I hid the forms in this folder to users with asp.net configuration manager but I want to add a shortcut for admins. I have a hyperlink
at the bottom of the site called "Admin Control Panel" which directs you to admin panel. But I want to make this button/hyperlink visible only for members who are in the "admin"s group. How can I do that? With loginview or something? Or should I use something
different from hyperlink?
I suggest you to use LoginView since it served this purpose. Between, you also have to configure to the Admin Folder to only allow "Admin" role users access to it. This will make sure other users will not able to access it if they have the link from somewhere
else.
*User always can copy & paste the page's url at the browser, not necessary to click on the hyperlink provided.
<location path="AdminFolder">
<system.web>
<authorization>
<allow roles="Admin"/> //Allows users in Admin role
<deny users="*"/> // deny everyone else
</authorization>
</system.web>
</location>
oned_gk: Thanks for the simple code buddy! Btw can I change this code for the roles I want like
MyLink.Visible= user.isinrole("poweruser")
CruzerB: Thanks for your caring. Actually I am using the code that you gave me to hide the admin panel forms in the sitemap. But can it also be used to hide the link? And I am adding this link to make it easier for the admins to login to
admin panel. You know... clicking on a link is faster than writing the url on the address bar.
Mac14
Member
46 Points
71 Posts
How to hide admin panel button
Nov 29, 2012 07:19 PM|LINK
Hello Everyone!
Hi masters, I created a folder in my site and it's called "admin". And I added the forms about administrating into this folder. I hid the forms in this folder to users with asp.net configuration manager but I want to add a shortcut for admins. I have a hyperlink at the bottom of the site called "Admin Control Panel" which directs you to admin panel. But I want to make this button/hyperlink visible only for members who are in the "admin"s group. How can I do that? With loginview or something? Or should I use something different from hyperlink?
I am waiting your useful tips.
Thanks!
msmk
Participant
776 Points
158 Posts
Re: How to hide admin panel button
Nov 29, 2012 08:29 PM|LINK
You can do something simple like set hyperlink.Visible = False
and then check to see if (user == admin)
hyperlink1.visible = True
oned_gk
All-Star
31595 Points
6454 Posts
Re: How to hide admin panel button
Nov 29, 2012 10:00 PM|LINK
oned_gk
All-Star
31595 Points
6454 Posts
Re: How to hide admin panel button
Nov 29, 2012 10:04 PM|LINK
MyPanel.Visible = user.isinrole("admin")MyLink.Visible = user.isinrole("admin")CruzerB
Contributor
5399 Points
1098 Posts
Re: How to hide admin panel button
Nov 29, 2012 11:44 PM|LINK
Hi,
I suggest you to use LoginView since it served this purpose. Between, you also have to configure to the Admin Folder to only allow "Admin" role users access to it. This will make sure other users will not able to access it if they have the link from somewhere else.
*User always can copy & paste the page's url at the browser, not necessary to click on the hyperlink provided.
http://weblogs.asp.net/gurusarkar/archive/2008/09/29/setting-authorization-rules-for-a-particular-page-or-folder-in-web-config.aspx
My Technical Blog
Mac14
Member
46 Points
71 Posts
Re: How to hide admin panel button
Nov 30, 2012 02:27 PM|LINK
Hey guys!
First of all thank you for your help!
oned_gk: Thanks for the simple code buddy! Btw can I change this code for the roles I want like MyLink.Visible = user.isinrole("poweruser")
CruzerB: Thanks for your caring. Actually I am using the code that you gave me to hide the admin panel forms in the sitemap. But can it also be used to hide the link? And I am adding this link to make it easier for the admins to login to admin panel. You know... clicking on a link is faster than writing the url on the address bar.
Thanks!
CruzerB
Contributor
5399 Points
1098 Posts
Re: How to hide admin panel button
Dec 01, 2012 09:10 AM|LINK
Hi,
It cannot be used to work with Hyperlink control to hide the link.
My Technical Blog
oned_gk
All-Star
31595 Points
6454 Posts
Re: How to hide admin panel button
Dec 01, 2012 11:20 AM|LINK