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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:28:39+00:00 2026-05-15T00:28:39+00:00

hopefully there’s an easy solution to this one. I have my MVC2 project which

  • 0

hopefully there’s an easy solution to this one.

I have my MVC2 project which allows uploads of files on certain forms. I’m trying to keep my controllers lean, and handle the processing within the business layer of this sort of thing.

That said, HttpFileCollectionBase is obviously in the System.Web assembly.

Ideally I want to call to something like:

UserService.SaveEvidenceFiles(MyUser user, HttpFileCollectionBase files);

or something similar and have my business layer handle the logic of how and where these things are saved.

But, it feels a little icky to have my models layer with a reference to System.Web in terms of separation of concerns etc.

So, we have (that I’m aware of) a few options:

  1. the web project handling this, and my controllers getting fatter
  2. mapping the HttpFileCollectionBase to something my business layer likes
  3. passing the collection through, and accepting that I reference System.Web from my business project

Would love some feedback here on best practice approaches to this sort of thing – even if not specifically within the context of the above.

  • 1 1 Answer
  • 1 View
  • 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-15T00:28:40+00:00Added an answer on May 15, 2026 at 12:28 am

    I’d just use a custom model binder if you want to keep the logic out of your controllers – then you can stick the extracted data into the model which you can do what you want with.

    http://www.heartysoft.com/post/2010/05/06/ASPNET-MVC-ModelBinding-Multiple-File-Uploads-to-an-Array.aspx

    Clarification – I consider model binders and other interception techniques to be a convenient way of splitting logic out of controllers and into separately maintainable containers – this is infrastructure code/web logic and thus does not belong in the business logic and thus can reference System.Web etc happily.

    Clarification – Effectively this is your Option 2 in disguise, you use model binders to map the unfriendly data into something the rest of your code can recognise, but you do it in a way that doesn’t compromise your clean controllers.

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

Sidebar

Related Questions

This is a little tricky to describe, but hopefully there is a solution. I
I'm new to jQuery so hopefully there is an easy answer to this. I
Hopefully there's a solution/patch to SubSonic SimpleRepository where I can specify a column/property with
I have a simple question, and hopefully there is a simple answer . .
This may sound like a strange question, but hopefully there is an answer out
This is going to be difficult to explain but hopefully there will be a
To begin with, I think this is a longshot but hopefully there is someone
Hopefully there is a simple answer to this as it seems a simple question,
hopefully there is a simple resolution to my challenge. I have a parent table
This was asked in 2008 . Hopefully there's a better answer now. How can

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.