Last post Mar 12, 2007 10:10 AM by Brian@Planet
Mar 09, 2007 05:13 PM|Pocketman|LINK
What is the "normal" folder in which to place database files? Is there a common architecture among hosting providers? Is ASP.NET as convoluted as I'm beginning to think?
I've been to 80 hours of certified Microsoft training and have been struggling with building a proof of concept database front end for three weeks. I cannot remember being more frustrated other than when I first moved from DOS to Windows. Although there
are a few quirks and "bugs" within Visual Studio, it does create fairly robust web pages without a lot of effort. Deploying to a hosted server however, is quite another story.
The hosting service I am currently using has wwwroot and db folders. All of my code is in the wwwroot folder and the Access database is in wwwroot/app_data folder. After some gnashing and weeping, it works. I think we really want the data file in the
db folder, but I don't know how to map it to there and do not understand Server.MapPath. I upsized the database to SQL Server and loaded it on the host's server. Works as expected, except users and roles don't want to function.
QUESTION: Is there a standard that Windows hosts use to support ASP.NET? If so, this stuff should be fairly seamless. Based upon my experience and what I read on this, and other, forums, I am not alone. [*-)]
Mar 12, 2007 10:10 AM|Brian@Planet|LINK
There's no required standard so the setup is pretty much up to each vendor.
I'm assuming here that your hoster sets you up with a wwwroot folder for your code and wwwroot\db for your databases. In that case there's nothing to stop you from adding a db folder to your project and putting the db there then your dev environment matches
the production environment.
Learniing to use Server.MapPath will make your life easier in that by calling it with the relative path of your database folder, it will return the full local path to that folder so for example 'string mydb = Server.MapPath("db")' will return the path to
the DB folder in the form of c:\inetpub\wwwroot\db. Where c:\inetput\wwwroot is the location of your code on your hosters server. That way, no matter where your hoster puts your code, as long at the database is in a folder called 'db' under your root folder, your
code can find it.
The other factor that my come into play. If your application updates the database, you may need to ensure that your sites application pool identity has write rights to the database or you may get an error there too.