views:

26

answers:

4

without using a database i wanted a file to point to the newest revision of a file. Someone suggested using a shortcut. Knowing i can rewrite file.ext to file.ext.lnk i thought it was a great idea. Then i tried it, my server (VS 2010rc) serves the shortcut rather then the file. Not what i wanted...

How do i serve the file the shortcut is pointing to? NOTE: I am planing to use windows 2008 as my server so a solution should work on that as well. The OS i am running is windows 7.

A: 

Take a look in CreateShortcut method.

It works all the way back to Win9X.

Paulo Santos
+2  A: 

Delete the shortcut, create a symlink.

In Windows >= Vista, you can do it from the command line: mklink from target

Coronatus
This seems right but i have 2 problems. 1) It seems like i MUST be an admin to run that command. 2) VS doesnt seem to be able to serve the file (but knows it exist). It looks like it doesnt have read permission which is weird (i dont get a 404 page after the link yet i see the filename of the img on server but no image. although Firefox can browse to it using file:// which makes this more weird)
acidzombie24
A: 

You can use the junction feature of NTFS to make more Unix-like links. See MSDN for general description and Junction for a command-line program which can create such links.

disown
A: 

You want to set up an HTTP 301 or 302 Redirect.

If the file is an ASP.NET file, look at Response.Redirect or Response.RedirectPermanent.

If it is a static file and you are using IIS7: http://technet.microsoft.com/en-us/library/cc732969%28WS.10%29.aspx

GWB