ASP.NET MVC Photo Gallery

Installation

Server Requirements

Your hosting provider must be able to run an ASP.NET MVC3 application in medium trust (Framework .NET 4.0).

Write-permissions are needed:

  • within the folder your are storing the pictures (Ex: d:\mydomain.com\data\images)
  • within the folder you are storing the cached thumbnails

There are NO database settings to be worried about :).

If you hosting provider runs II6, you may need to do some tweaking (read about this here)

Create a virtual application folder

In order to make any ASP.NET MVC application work, you need to deploy it in a virtual application folder. That ensures that IIS is going to be able to find the assemblies located on the bin folder, web.config files, etc

If you just create a folder inside your wwwroot space and drop the files there, it won't work.

How to create a virtual application folder in IIS

If you manage your own IIS server, there is a helpful link here that shows how to create virtual application folders

If you are using a shared hosting, you may need to enter into the control panel provided by your company. In case you are using HELM< in your hosting provider/strong>, these are the steps to do it yourself:

Click on virtual directories
Virtual folder on helm 1
Add new virtual directory
Virtual folder on helm 2
Configure virtual directory parameters

You will need to set which folder of your root application will act as virtual folder

Virtual folder on helm 3

Deploying the files

Just unzip the package and copy all the files into the virtual folder you just created. You normal will do that using a FTP client.

This is how my /demomvc virtual application looks then I access it using a FTP client:

FTP files

Accesing the application

At this point, if you did correctly the above steps (creating the virtual folder and placing the files) you should be able to hit the application. If you get a 404 error (page not found), that's probably because you server runs an old version of IIS. Please check the troubleshooting area to know how to fix it.

If you get a yellow screen instead, saying something like there has been an error in the application finding the images, you are in the right path! let's configure the application!

Configuration

Where are your pictures?

Open ajaxphotogallery.config and specify the pyshical path where your images are located (RepositoryPhysicalPath configuration entry)

Just with that you are almost ready to go.

Setting administrator accounts

Open ajaxphotogallery.config and define who is admin (you can have more than one)

Application configuration file

How can I set a folder as private?

You just need to edit the config file associated to that folder like and set the PrivateFolder=true and then the list of users that are going to be able to access the folder like this:

Private Folders

Permissions are inherit so if you set a folder as private, the subfolders will be private too

top

Email notifications using Postmark

Notification service using Postmark

The default email notification service is Postmark (leave sending email for the people that actually know how to do it)

Postmark is a reliable service (hassle free) to send your email.


In order to make email notifications work with Postmark you will need to:

  • Sign up for PostMark (it is free for the first 1000 emails and really cheap if you don't have much traffic - worthy if you have it though)
  • Get a Postmark API Key and paste it into your configuration file

Troubleshooting

When I change the application configuration file (ajaxphotogallery.config) nothing happens

Configuration is stored in memory and read just once, so if you change the configuration file, make sure the application restarts (for example, by updating the web.config file you will force application to restart and configuration file to be read from disk again)

I installed the application in my windows hosting provider but it is giving me a 404 error

The application runs on ASP.NET MVC, so there is not default file to call (like default.aspx). Instead, IIS transfer the control of the web request to the ASP.NET MVC, that lookup the right route (for example /pictures) and translate into a controller action and code execution.

If nothing is executed, please check that: