what is the app_data folder really for?

G

Guest

hi folks
I'm working on reverse engineering TheBeerHouse by Marco Bellinaso which
appears to have 100% unanimous approval on Amazon.
I got the book and downloaded the code and I opened the solution.
in his readme.txt he recommends that you move the database files he gives
you in the App_data folder (called oddly aspnet.mdf and aspnet_log.mdf) and
then attach them using sp_attach and rename them

I renamed these TheBeerHouse (mdf and ldf) and put them on another drive on
my XP prof machine and attached them to my SQL server 2005 (developer
edition) and I changed the connection string in web.config to reflect my
local settings.

everything works when I press F5, but my question is, what is the point of
app_data folder, it now has the non-attached original database that Bellinaso
provided in the download and I can't figure out a way to view the real data
on the SQL server through visual studio 2005 (but I can through the SQL
server management console). When I tried to add the now attached
TheBeerHouse.mdf file, I was informed that the file was in use (i.e by the
SQL server 2005 service)

should I have kept the database files in App_data and attached them to SQL
server from there? if not why would anyone ever use App_data, since SQL
server has its own data directory! I ask all this as an old C# asp.net 1.1
hand and am slightly baffled by the need for this data folder...


Regards and thanks in advance,
Charles
 
C

Cowboy \(Gregory A. Beamer\)

App_Data allows you to use a file based SQL Server database (or Access, if
you like more pain ;->). If you are using an actual server, there is no
reason to have App_Data.
 
J

Juan T. Llibre

re:
what is the point of app_data folder

As Cowboy told you, App_Data allows you to use a file-based database.

That includes not only SQL Server 2005 and Access, but also XML files
and Excel worksheets, among others, i.e., *any* file-based data store.

The real advantage is that any file you place in APp_Data won't be downloadable
if a direct request for it is made over the wire, i.e., your data can't be hijacked.

The content in all the special ASP.NET folders other than
App_Themes is not be accessible via http requests to the server.

re:
should I have kept the database files in App_data and attached them to SQL server from there?

For SQL Server *.mdf files, it's not critical.
For other types of file-based data, it is.

re:
When I tried to add the now attached TheBeerHouse.mdf file,
I was informed that the file was in use (i.e by the SQL server 2005 service)

Just unattach them, move them to App_Data, and re-attach them.
You may need to stop the SQL Server 2005 dev edition service, though.

re:
why would anyone ever use App_data, since SQL server has its own data directory

Maybe it's not so critical for SQL Server database files,
but you may need to use other file-based data, and be
sure that they won't be directly downloadable.
 
M

mimranm29

CharlesA;6853312 said:
thanks very much Juan, much appreciated...
Regards,
Charles

Dear Charles, you wrote that you have made the connection and
everything was working fine. Will you please give me some example code
how to connect to the mdf files placed in App_Data Folder.

Regards,
Imran
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top