i have few pages in asp.net ,
when a user logs in then i want t give him access to 4 out of 10 pages, mean he can only view 4 pages out of 10, else are for admin + superadmin,
so how could i assign him authority to few pages ? and restrict from other ,
Ok, this is a big topic. There's quite a bit of information out on the Internet on how to do this. I am going to suggest that you visit these links and read over the information. This is same info that I refer to when I need to integrate authentication in my projects.
Since you are using C#:
How To Implement Forms-Based Authentication in Your ASP.NET Application by Using C#.NET
More information about forms based authentication:
Using Basic Forms Authentication in ASP.NET
Great resource over asp.net security (a must read):
Again, you can code all of this by hand, use session variables, keep roles in a database table, but before you do so, take a look at what asp.net built-in controls and objects can do for you.
but requirement is to code by hand, lines of code, you know
so i kept 3 roles in db, and 1,2,3 for admin, subadmin, and applicant
and used session variables to store user email after login , but problem is that he/she can view all pages , so how to restrict via code ? like i made db roles+ sessions
in your code behind, check for the session variable. If its empty, send the user to the login page. If not, check to see what role the user logged in as. If its an admin page and the user is not an admin, redirect them to a "unauthorized page", or appropriate page.
`.model small .stack 100 .data kernel DB 10 DUP(1) input DB 1, 2, 3, 4, 5, 6, 7 output DB 0, 0, 0, 0, 0, 0, 0 .code MAIN PROC ...
<!doctype html> <html lang="en-US"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Empathy</title> <link href="template.css" rel="stylesheet" type="text/css"> </head> <body> <div class="container"> <header> <a href=""> <h4 class="logo"> <img src="page-1_2.png" ...
So I have website listing characters from a multi person RP I take part in
the site uses bootstrap as well as a mysql database. I have a working search ...