Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6210383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:08:59+00:00 2026-05-24T06:08:59+00:00

i have a application with a roles table and a permission (user permissions per

  • 0

i have a application with a roles table and a permission (user permissions per form) table different roles has different access levels and each user has specific access permissions to each form .
can i implement it using FormsAuthentication ?

thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T06:08:59+00:00Added an answer on May 24, 2026 at 6:08 am

    You have to pass the list or roles to FormsAuthenticationTicket

    Here is the complete code, I have added comments as well.

    protected void lbtnSignIn_Click(object sender, EventArgs e)
    {
     .......Login credential checking code......
     .......If the use verified, then add the roles to FormsAuthenticationTicket 
     .......I am assuming in the below code, you are getting list of roles from DB in DataTable
     String roles = String.Empty;
     if (dtblUsersRoles.Rows.Count > 0)
        {
         for (int count = 0; count < dtblUsersRoles.Rows.Count; count++)
         {
          //build list of roles in comma seperate
          roles = roles + "," + dtblUsersRoles.Rows[count]["RoleName"].ToString();
         }
        }
    
    FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, txtUserID.Text, 
    DateTime.Now, DateTime.Now.AddMinutes(30), false, roles.Substring(1, roles.Length - 1), FormsAuthentication.FormsCookiePath);
    string hashCookies = FormsAuthentication.Encrypt(ticket);
    HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, hashCookies);
    Response.Cookies.Add(cookie);
    }
    

    then you can check the user, if he lies in certain role

     if (HttpContext.Current.User.IsInRole("Super Admin"))
     {
      ...................
     }  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that needs to hit the ActiveDirectory to get user permission/roles
We have an ASP.NET application that manages it's own User, Roles and Permission database
I’m writing an CI application that has to have authentication and preferably different roles
I have already created a form authentication application. I had User table and created
So I have an application that has several modules (think of modules as different
My application database has a Groups table that separates users into logical roles and
I need to add user roles and permission system into my web application built
I have an entity relationship setup in my mvc2 application such that each user
A User can have many roles, but only one role per Brand. Class User
I have application that makes different queries with different results so the caching in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.