views:

416

answers:

2

This isn't a very complicated scenario really, but as I start to type out the problem I'm realizing how convoluted it can become textually. Let me try and be very clear:

First, the set up...

I have a C#/ASP.NET web application that is publicly facing on my main domain (www), let's call it www.mysite.com. Nothing fancy, just a front-end that connects to SQL to display records.

Then, I have a second C#/ASP.NET web application that is secured using forms authentication running on a subdomain, let's call it admin.mysite.com. This is a very light-weight CMS system to administer the public site.

Now, the problem...

Both of these sites run fine for basic tasks, however, my problem arises when I try to gain access to the file system for uploading. GoDaddy requires subdomains to run as a virtual directories under the main application in IIS (so the subdomains actually resolve/re-direct to www.mysite.com/admin when you type in admin.mysite.com), but because of this I am unable to write to my website root from the subfolder.

Let me explain a little more...

The CMS system (running as a virtual directory) gives the admin the ability to upload photos for display on the main site, the target folder of which is www.mysite.com/images - when attempting disk access from the root app, I am able to write to the virtual directory, but cannot do the opposite -- that is, write to the root from the virtual directory, getting security violations. If I can only upload to the /admin/ virtual directory, the entire point is moot because it's a secured folder that the public can't see!

The only solution I can think of is to upload the files to the /admin/ virtual directory, then call a URL in the root that moves files from /admin/ back to the root, but that is entirely ghetto.

I hope this post makes sense. Anyone else experience anything like this? The bottom line is that it seems virtual directories ONLY have access to themselves, and not their parent directories, no matter what credentials are used.

Thanks!

A: 

Somewhat unrelated to your question.

GoDaddy is not a great host due to things like you have stated. I recently went on the search for a host and wholeheartedly recommend JodoHost.com.

Some post I wrote on the matter:
http://www.ocdprogrammer.com/post/2009/12/16/The-search-for-a-web-host.aspx http://www.ocdprogrammer.com/post/2010/01/03/JODOHostcom.aspx

However, the behavior you are seeing seems very normal to me. A sub domain not being able to access the root domain. Though with a dedicated server you could overcome this, but one of the drawbacks of a shared host.

Clarence Klopfstein
A: 

In that case, I think I would consider using a database.

Here's how I would do it:

  1. The files are uploaded into the /admin directory
  2. The admin app writes the URL of the file into the database that it shares with the root app
  3. The root app loads the URL from the database and uses it to point to the file.

I think that is the best way to approach it, under such circumstances.

Maxim Zaslavsky