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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:17:50+00:00 2026-05-16T16:17:50+00:00

What are best practices concerning error handling in an ASP.NET MVC2 web app that

  • 0

What are “best practices” concerning error handling in an ASP.NET MVC2 web app that is DDD designed? For example, let’s take the most common aspect of a web app, the login:

  • UserController: Obviously coordinates
    a few domain objects to eventually
    log in or refuse the user, and
    redirect to other parts of the web
    interface as needed. In my case, it’s
    a few calls to different UserTasks
    methods like IsLoggedIn() or LogIn(),
    plus some RedirectToAction.
  • UserTasks: Has the meat of the work
    of coordinating relevant domain
    objects services, like
    SecurityService and lower domain
    objects, such as calling
    SecurityService.ValidateUser() or
    checking User.IsUserInactive().
  • SecurityService: Obviously
    coordinates
    authentication/authorization
    services. Similar to a
    MembershipProvider, without the
    excess baggage.
  • User: Represents the user. Not
    anemic, as it has various
    User-specific methods such as
    IsuUserInactive() that checks
    IsDeleted, IsLockedOut or if the user
    is between FromDt and ThruDt.

How do you bubble up errors such that they are informative and not hostile to users? Do you litter code with exceptions and then just handle them all in Application_Error()? For example, should ValidateUser() throw an ArgumentNullException() when password is empty and a AuthenticationException() when the password isn’t right, or return a bool = false? If the latter, how do you inform the user of what caused the validation to fail?

  • 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-16T16:17:50+00:00Added an answer on May 16, 2026 at 4:17 pm

    I’m assuming you’re using WhoCanHelpMe / S#arp Architecture based on the naming conventions I see? If so, I’d highly recommend a look at this article which demostrates the implementation of a cleaner application services layer. Have a look at the ActionConfirmation result being returned from the service layer; we have found this an ideal way to return a less-than-nasty error result from the Tasks layer.

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

Sidebar

Related Questions

From a practical and best practices perspective, should rails models that have HABTM association
Anyone have any best practices tips for Rails and sessions? The default session type
What are the best practices for working with Sql server Xml columns to ensure
Possible Duplicate: Best practices for validating email address in Objective-C on iOS 2.0? I
Are there any best practices for writing a power-efficient background application in Symbian? Specifically,
What's the best practice for converting very large windows solution to multi-language . There
I am having an inconsistent issue being produced on one of my servers whereby
I'm converting procedural JS to OO and would appreciate any help. In a nutshell,
When I receive code I have not seen before to refactor it into some

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.