tags:

views:

336

answers:

6

Ok, my web application is at C:\inetpub\wwwroot\website

The files I want to link to are in S:\someFolder

Can I make a link in the webapp that will direct to the file in someFolder?

+7  A: 

If its on a different drive on the server, you will need to make a virtual directory in IIS. You would then link to "/virtdirect/somefolder/"

Rob Cooper
A: 

You would have to specifically map it to some URL through your web server. Otherwise, all your files would be accessible to anyone who guessed their URL and you don't want that...

A: 

That depends on the configuration of your web server. Probably not. You don't want the web server to be able to access any file on the hard drive (ie your passwords file), so only those files configured to be accessible in the web server's configuration files are accessible and can be linked to. Usually these are all kept under one directory. You could, of course, copy someFolder and place it under your web directory, then it would be accesible, or if you are sure it is safe, change the configuraton of your web server to allow access to that folder.

Devin Ceartas
Creating a virtual directory in IIS would solve all of the above. You can set up security permissions based on that and access the files in the folder without the need to dupe..
Rob Cooper
yes, exactly what i meant by "change the configuration of your web server to allow access to that folder".
Devin Ceartas
A: 

Do you have another virtual directory/application pointing to s:\someFolder? If so, it's just a simple link.

Are you trying to stream files back? If so, take a look at Response.TransmitFile and Response.WriteFile.

Otherwise, maybe you could create a handler (.ashx) to grab a specified file and stream its contents back?

Matthew Cole
A: 

i think there are only two ways 1) make a virtual path wich points to download directory 2) call a your aspx/ashx handler wich load file locally and send it to client.

stefano m
A: 

A solution which works at the OS level rather than the webserver level is to make a symbolic link.

Links to files are supported on Vista and links to folders ("junctions") are supported on Win2000 onwards.

Hugh Allen
This is a good suggestion, but security may be an issue, using VirtDirs you have a lot of control over how the web users can interfact with the folder, without upsetting your local file system.
Rob Cooper