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

  • SEARCH
  • Home
  • 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 742961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:48:29+00:00 2026-05-14T08:48:29+00:00

I know what are you saying already (baad idea), but please read first :)

  • 0

I know what are you saying already (baad idea), but please read first 🙂

I am developing ASP.NET MVC based app, which will require some specific features:

  1. combination of “local” users and facebook connect login, but FB users will be “mirrored” to some kind of local representation, because there will be some statistics and other stuff needed to keep for both types

  2. authorization will be 3-layered instead of asp.net standard 2 layers. By this i mean : User is in Group (m:n) and Group is in Role (m:n), instead of User is in role (m:n).

So, if i would want to use standard authentication/authhorization approach, i would have to:

  1. implement custom Membership provider, and it wont be even “right”, because it will utilize methods like AddUserToGroup and AssignRoleForGroup etc.

  2. implement custom Principal/Identity for sake of accessing my own User objects

  3. casting HttpContext.User to my object every time needed…

  4. implement custom Role provider

  5. custom mechanism of sessting AuthCookie (unique userId in userdata, cant rely on username with third-party FB users in system)

  6. … (you surely can think of something else)

Well, i really dont like the idea of “bending” and replacing every part to get pretty messy solution in the end. So I think of implementing my own mechanism encapsulated in one place – lets call it AuthService.

  1. AuthService will be thread-safe singleton
  2. Instead of AuthCookie will be using standard Session object (i know sessions also use cookies, but i really dont see advantage of low-level storage (cookie) over session)
  3. AuthService will provide AuthService.CurrentUser (of my own type), populated from session on beginning of every request (Application_AuthenticateRequest, I think)
  4. AuthService will provide in one place all methods – ValidateUser, RolesForUser, IsInRole, Logout, etc.

So now.. why should I not do this this way ? 🙂

I think session is equally secure to AuthCookie (same risks for ticket and authcookie)..
I dont really look for “modularity” (plug-and-play role providers, membership providers, profile providers..) – I deal here with pretty specific stuff, I dont expect standard components to fit.. have “my approach” any other disadvantages ?

Thanks for all good ideas and sorry my terrible english, I am from non-english-speaking country 🙂

R.

  • 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-14T08:48:30+00:00Added an answer on May 14, 2026 at 8:48 am

    I can certainly see why you don’t want to implement an entire Membership provider. However, I would take advantage of the low-level support offered by Forms Authentication (e.g. the cookie, expiration etc.) and just do my own custom authentication. If you do this, you can inject your own custom user class into the HTTP context and use it throughout your code. Your custom user object would implement IIdentity and IPrincipal. Your IPrincipal.IsInRole would work against your custom authentication scheme. This would allow your higher level code to use standard .NET framework permissions stuff. This is the neatest, simplest way to accomplish what you want while taking advantage of what already exists.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this might be a no-brainer, but please read on. I also know
When I type ctags -e it returns an error saying it doesn't know that
Know this might be rather basic, but I been trying to figure out how
I know there has been a lot of posts on this but it still
I don't know if I'm on the right track but I'm trying to let
I learned C++ at school, but there are several things I don't know, like
I know that all forums are full of such question, but I've tried few
I already look at java library and dont know what to use to do
Let's say that any C function has a pointer already declared, but not assigned
I will start by saying I've read this topic: C++ Return reference / stack

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.