Click here to Skip to main content
15,667,077 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
am create a e-commerce website.
there are two type of user roll
1:-Admin Page
2:-User Login Pages
now I have a problem
when I login with user account and give admin pages link
user can access easily admin pages
how can I fixed this problem when user write admin page link then page going on its home page

What I have tried:

role based authentication for user or amdin
Updated 8-Mar-16 1:49am
debashishPaul 7-Mar-16 16:55pm    
Are you using MVC or WebForm?
Arslan saif 8-Mar-16 4:32am    
Philippe Mori 9-Mar-16 12:16pm    
Tons of tutorial exists on the web...

Try create a sites in folder of "Admins", allows only roles admin access in web.config.

<location path="Admins">
                <allow roles="Admin" />
                <deny users="*" />
Share this answer
Arslan saif 8-Mar-16 4:33am    
can you explain this more
It jump back to home page because the authorization is not allowed.

Have you ever using

okay , you know how to use ASP.NET Web Sites Administration Tool, right?

set a "Admins" roles right there, and assign that user to Admins roles.


then followed the same as i show you on top post.

then in login view, create a value "Admins" in "Edit Item" and switch it in rolegroup,
last add hyperlink to bring you to that pages.

<asp:LoginView ID="LoginView1" runat="server">
	<asp:RoleGroup Roles="Admins">
   			<asp:HyperLink ID="HyperLink1" NavigateUrl='<%# "~/Admins/ManageAdmin.aspx?id=123" %>' runat="server" Target="_blank" />
Share this answer

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

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