Application Root Operator (~) problem with Virtual Directory in IIS 6.0 - iis-6

I have a web application that runs fine locally, but when I move it to a virtual directory on the web server (let's call it "VirDir"), it adds the directory name to the relative path.
For example, if I try to access ~/Default.aspx, it will tell me that it cannot find /VirDir/VirDir/Default.aspx.
Is it something boneheaded, or do I just have to use absolute addressing to make it work (if I try to access /Default.aspx, it finds it fine)?

That's the way it is... Use absolute addressing as /default.aspx.
Might help explain your case:
http://forums.asp.net/t/1521537.aspx
Take a look here to better understand iis 6 and virtual directories:
http://msdn.microsoft.com/en-us/library/zwk103ab.aspx

Related

Virtual Directory to navigate to http://localhost/MyWebsite instead of http://localhost:8080

I have deployed an ASP.NET MVC 4 application to a new site I have created in IIS 7.5, which I have bound to port 8080. I can reach it by navigating to http://localhost:8080, but I want to reach it via http://localhost/MyWebsite.
I have added a Virtual Directory under my website, which points to "C:\inetput\wwwroot\MyWebsite\". However, when I navigate to http://localhost/MyWebsite, I am presented with a configuration error:
"It is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level. This
error can be caused by a virtual directory not being configured as an
application in IIS."
Here is what my IIS hierarchy looks like (this is a demo since I have no internet access on the server I am working on).
I have two questions:
Why am I getting this error?
Is this the best way to go about achieving what I want? It seems messy to have the list of files and folders underneath the website and then again underneath the Virtual Directory. If there is better practice then please tell!
Virtual Directories cannot execute scripts, reason why you are getting that error. You need to make your MyWebsite folder an Application. Also, you don't necessarily have to create a separate website for your website, you can use the Default Web Site and create an application MyWebsite in there (it might be less confusing maybe?).

IIS 6 localhost works but nothing else does

If I type localost in IE, it yields "It works!" but I can't seem to locate where exactly that page is picked from.
In c:\InetPub\wwwroot\ nothing exists that points "It works!" page.
I created a test folder inside wwwroot above. I put an aspx file there, it does not work (no file found), then i created a test.htm file, that can not be accessed through localhost/test/test.htm
Anyone knows what is wrong. I never ran IIS on this particular system. I have Windows XP Pro, and IIS6 is installed.
Please help.
I think it will answer it myself. There were two confusion first of all, IIS 5.1 was installed along with IIS 6 (there was a link in Administrative tools) and Apache server as well. Something was probably messing with it before I came. I uninstalled Apache, IIS 6 link (was not supposed to be there in the first place), and even IIS. Fresh installed fixed everything.
Also if you are running into problem like this, get familiar with IIS, how it works. It runs out of Virtual folders and you have to turn these virtual folders into Applications. It is tricky the way Microsoft do it.
In my case probably both the server were using the default port 80 (I am not sure though). I now have both servers intalled (IIS + Apache), with Apache using port 8080.
To test situation like this, do this: create a virtual folder in IIS 5.1, right click on it and turn that folder into application. Put an aspx file in the "actual" location that this virtual folder points to see and then open it in browser using localhost\virtualfolder\myaspx.file. Note that in many case IIS will not pick the default.aspx file automaticaly unless explicity given.

Resolving a remote $HOME directory via FTP/SFTP

In Objective-C, NSString has a method called
stringByExpandingTildeInPath
This method will take a string like "~/Documents" and resolve it to "/Users/Nick/Documents". The "~" tilde is resolved to the home directory of the current user of the machine the program is running on.
Now my question is this... I am writing a little FTP/SFTP utility using Cocoa and Objective-C. How could I resolve a tilde (~) path on remote machine via FTP/SFTP?
For example. A user wants to upload a file to
sftp://remote-host.com:~/
If remote-host.com is a Linux or OSX server, then this path is totally valid. However uploading a file only works when I specify the absolute path. I'm not sure if this is a limitation of the framework I'm using, ConnectionKit, or if this is something that I need to manually implement. I'm ok with the latter but, any suggestions on how?
You could try just removing the "~/" (and use the rest as a relative path) - generally the server should put you in the user's home directory by default when you connect.

httpHandler works for virtual directory but not similarly configured website

I am setting up a 3rd party website which makes heavy use of httpHandlers. When configured as a virtual directory under Default Site on a 2003/IIS6 machine, everything works as expected. When configured as a standalone site on the same machine, pointing to the same directory and web.config however, httpHandlers do not work (404).
I have tried various changes to the path values of the handler's tags with no results. The pages themselves, and the application's code, all seem to execute find within the standalone site.
Any obvious things I might be missing?
Found my own answer, was a very simple thing.
An installer package had installed the virtual directory version of the site, and it had taken care of adding the file extension mappings. The standalone was manually configured and as such, I missed adding the mappings.
Resolved.

Using Alias in Apache ONLY if local directory not present?

We're running a reseller web host, and aliasing a particular directory for ALL the sites within. This is all happening through WHM/Cpanel, which could possibly complicate my question.
We want all hosts to run their "/concrete" directory through a shared location on the server. This is working fine by adding "Alias /concrete/ "/usr/local/share/concrete5/concrete-latest/concrete/" to the apache include editor in WHM.
However, if a local concrete/ directory exists within the particular webroot of the virtual host, we'd rather use that than "/concrete" globally. It would also be nice if we could make this alias change in the context of the virtual host, within WHM (and I haven't found a great way to modify virtual host sections in WHM without hacking a file that I don't believe we're supposed to hack.)
Thoughts?
A primitive, although probably quite effective solution might be to forget about the Alias directive and to simply rely on a symlink. A little shell script that creates those symlinks for you will simply fail if there is already something present that is called 'concrete'.