如果我需要能够处理 ASP.NET MVC 中的附件,您将如何设计消息传递功能?

发布于 2024-08-14 04:42:53 字数 647 浏览 14 评论 0原文

我正在开发一个 ASP.NET MVC 站点,我的部分要求是用户能够互相发送消息。

从表面上看,这并不是一项艰巨的任务。最简化形式的消息传递只是一个“消息”表,其中包含“SenderID、ReceiversID(FK)、主题、消息”等。

但是,您将如何处理“附件”?用户可以浏览我们网站上包含财务信息的机密 PDF,并且他们应该能够单击“发送报告至”按钮将报告连同短信一起发送给其他用户。

同样,他们将能够上传多个文件,并将它们与消息一起发送(而不仅仅是他们可以浏览的内部文档)。

在 ASP.NET MVC 中你会如何处理这个问题?

我考虑过在某个地方有一个附件文件夹和一个附件表,因此,如果用户单击“将报告发送到”或上传文档,该文件将被复制到附件文件夹,并在附件表中创建一个条目。

然后,如果用户单击具有 /messaging/attachments/{fileID} 之类的路由的链接,它将向他们发送适当的文件。我什至可以维护附件/文件表中每个文件的校验和,因此如果用户发送相同的报告,我们将不会在附件文件夹中复制文件。

在某种程度上,我感觉我正在重新发明电子邮件,但客户坚持认为,为了保持安全合规性,我们不能简单地将这些报告通过电子邮件发送给我们的用户,他们必须登录我们的系统才能检索它们。

这是解决此类问题的正确方法还是我应该考虑不同的方法?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

奶茶白久 2024-08-21 04:42:53

我不确定您的具体要求,但您可能会考虑使用 CMS 系统或共享点。这些将具有内置文档管理和消息传递所需的机制。即使您的应用程序是独立的,您仍然可以将其与 sharepoint 集成作为后端,以减轻其大部分复杂性。

在大多数方面,你都在重新发明轮子……而且这是一个非常大的轮子。尽量不要被碾压:)

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 :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文