How do i serve shortcuts/.lnk from web servers?
w开发者_高级运维ithout 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.
Delete the shortcut, create a symlink.
In Windows >= Vista, you can do it from the command line: mklink from target
Take a look in CreateShortcut method.
It works all the way back to Win9X.
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.
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
精彩评论