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 6862141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:37:31+00:00 2026-05-27T02:37:31+00:00

For practicing purposes, I’m about to create a new ASP.NET MVC 3.0 application. My

  • 0

For practicing purposes, I’m about to create a new ASP.NET MVC 3.0 application.
My solution (Practice.sln) will have 4 layers:

  • Pratice.Common (class library for my ViewModels)
  • Pratice.Data (class library for EF)
  • Pratice.Service (class library for business logic)
  • Pratice.Web (asp.net mvc 3.0 project)

Let’s assume I have a View called “Login” which is strongly typed on a LoginModel defined in my Practice.Common layer.
The LoginModel has 2 properties (username and password).

In my Controller, when the user submits the form, I call the following method:

[HttpPost]
public ActionResult Login(LoginModel model)
{
    if(_service.ValidateUser(model))
    return null;
}

The ValidateUser() is a method defined in my Pratice.Service layer (inside my LoginService.cs file).

I’m basically delegating the validation process to my Service layer…


My question is the following:

Considering I’d like to try/use the benefits of Membership Provider, and considering that most (if not all) my logic is happening in my Service Layer, how can move Membership into my Service Layer? (if that’s even a good thing)

Also…I was planning on creating my own Membership Provider as opposed to the built-in one since I’m not using all those generate TABLES and sprocs…

Bonus question:

Is it considered best practice to have all the login and account management happening directly from within your Controller and all the rest of my business logic kept inside my Service Layer?

I’m curious in the Pros and Cons of having “parts” of the logic happening directly inside the Controller and other “parts” happening in the Service Layer.

Of course, if anyone has a link or article that explains this, I’d be grateful!

Sincerely

  • 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-27T02:37:31+00:00Added an answer on May 27, 2026 at 2:37 am

    Ok, after a few trials and more reading, I’ve managed to answer my own questions.

    As far as moving the Membership Provider to my Service Layer (in my case) that doesn’t make any sense since my Service Layer will now have a dependency on System.Web.Security and I do not want that.

    In addition, I quickly realized I was confusing two concepts. FormsAuthentication and Membership. Although they work hand-in-hand, I don’t need all the methods provided by Membership. Therefore, I do not need to create a Custom Membership Provider nor use the built-in one.

    All I need to do is to continue to create my methods in my Service Layer (such as a Login() method) and then, manually create a FormsAuthenticationTicket which I’ll add inside a cookie then add that cookie to the cookie collection (in the Controller).

    As a side note, I also realized that it is only once you’ve added the cookie to the cookie collection that the HttpContext.User.Identity.IsAuthenticated starts returning TRUE.

    As far as my bonus question goes, unless told otherwise, I’ll keep the login mechanism (and validation) in the Service Layer instead of having some logic in the Controller and some logic in the Service Layer.

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

Sidebar

Related Questions

I'm practicing writing MVC applications. I have a Mastermind game, that I would like
I have started practicing TDD approach. I am pretty much new to unit testing.
I'm practicing to use embedded resource in ASP.Net. I wrote a javascript file, put
I'm practicing my Rails development skills by building an app that will have different
Im practicing with one way hash encryption. I have a MVC model with Entity
I have been practicing DDD for a while now with the 4 distinct layers:
I have been practicing TDD and (some) XP for a few years now and
I have been practicing TDD in C# for several years now and recently have
I've been practicing for an upcoming programming competition and I have stumbled across a
I'm practicing PyQt and (Q)threads by making a simple Twitter client. I have two

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.