English 中文(简体)
How would you design messaging functionality if I need to be able to handle attachment in ASP.NET MVC?
原标题:

I m working on an ASP.NET MVC site and part of my requirements are that users are able to message eachother.

On the surface this isn t that hard of a task. Messaging in its most simplified form is simply a "Messages" table with things like, "SenderID, ReceiversID(FK), Subject, Message", etc.

However, how would you handle "attachments"? Users can browse through confidential PDFs on our website containing financial information and they are suppose to be able to click a "Send Report To" button to send the report to some other user, along with a textual message.

Similarly, they would be able to upload multiple files, and send them along with their message (not just the internal documents they can browse).

How would you handle this in ASP.NET MVC?

I ve considered having an attachments folder somewhere and an attachments table, so if a user clicks "Send report to" or uploads a document, that file is copied to the attachments folder and an entry is created in the Attachments table.

Then, if a user clicks on a link that has a route like /messaging/attachments/{fileID}, it will send out the appropriate file to them. I could even maintain a checksum of each file in the attachments/files table so if a user sends the same report we won t be duplicating the file in the attachments folder.

In some way feel like I m re-inventing email but the client insists that in order to maintain security compliancy we can t simply email out these reports to our users, they must log into our system in order to retrieve them.

Is this the right way to go about something like this or should I look at a different approach?

问题回答

I m not sure of your requirements exactly, but you might consider using a CMS system or sharepoint. Those will have the mechanics you need for both the document management and messaging stuff built in. Even if your app is separate you can still integrate it with sharepoint as a back-end to offload the bulk of the complexity to it.

In most ways, you are re-inventing the wheel here... and it is a really BIG wheel. Try not to get run over :)





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签