创建私有照片库使用Asp.Net MVC [英] Creating A Private Photo Gallery Using Asp.Net MVC

查看:134
本文介绍了创建私有照片库使用Asp.Net MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个用户管理照片库服务。我这个工作只用Asp.net一百万次,但如果有,我需要使用Asp.net MVC时做出任何特殊考虑,我不知道。

I need to create a photo gallery service that is managed by users. I've done this a million times using just Asp.net but I was wondering if there are any special considerations that I need to make when using Asp.net MVC.

基本上,我将存储在文件系统中的实际图像和存储在所述图像链接到特定的用户数据库中的位置。在用户的画廊的图像应不会被除注册用户的任何人访问。意思是,我需要为p $ pvent用户莫名其妙美元,从与别人画廊谁是不是网站的用户共享图片的URL。

Basically, I will be storing the actual images on the filesystem and storing the locations in a database linking the images to a specific user. The images in a user's gallery should NOT be accessible by anyone except registered users. Meaning, I need to somehow prevent users from sharing the URL of an image from a gallery with someone who is not a user of the site.

在过去我这样做是使用的身份验证,该请求被允许访问图像资源一些通用的处理程序。我可以使用相同的模式,但使用控制器呢?我想也许是创建一个照片控制器,只需简单的GET动作。这会要求我刚才用于显示的图像的图?

In the past I did this using some generic handlers which authenticated that the request is allowed to access the image resource. Can I use the same pattern but using Controllers instead? I was thinking of perhaps creating a Photo Controller and just a simple Get action. Would this require that I have a View just for displaying an Image?

我在正确的轨道上,或是否有这样做的更好的方法? (除了在数据库中存储图像)

Am I on the right track or are there better ways of doing this? (Besides storing images in the DB)

推荐答案

这个链接介绍如何创建一个自定义ImageResult类。我能够做的正是我需要它后面

This link explains how to create a custom ImageResult class. I was able to do exactly what I needed following it

http://blog.maartenballiauw.be/post/2008/05/ASPNET-MVC-custom-ActionResult.aspx

这篇关于创建私有照片库使用Asp.Net MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆