hi,
this might be a simple one to them who know:
i'm developing an asp.net project and use the debug mode. i have a xml
file which contains data, that shall be read, if a specific page is
run. when i build the project the file is correctly copied to the
build location (i selected "build action: none" and "copy if newer").
but when the project is run, the xml file is missing at the directory
from which the site is executed. it does not get copied there
automatically. in my case the directory where the site is executed is
"c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE \"
what do i have to do, so the file is available in the the directory
where the site is executed at execution time?
thanks in advance,
arthur 7 2611
re:
!what do i have to do, so the file is available in the
!directory where the site is executed at execution time?
Is there anything stopping you from using the
App_Data folder to store your application's XML data ?
It's much safer than storing an XML file in the root directory, anyway, since XML files
in the App_Data directory are not served to clients, even if requested directly.
If you store your XML files in the App_Data directory, all you have to do is
check the "Include files from the App_Data folder" option when publishing your website.
VS will upload your XML data files to the App_Data directory.
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== ========
"Arthur" <am*@gmx.infowr ote in message news:47******** *************** ***********@r66 g2000hsg.google groups.com...
hi,
this might be a simple one to them who know:
i'm developing an asp.net project and use the debug mode. i have a xml
file which contains data, that shall be read, if a specific page is
run. when i build the project the file is correctly copied to the
build location (i selected "build action: none" and "copy if newer").
but when the project is run, the xml file is missing at the directory
from which the site is executed. it does not get copied there
automatically. in my case the directory where the site is executed is
"c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE \"
what do i have to do, so the file is available in the the directory
where the site is executed at execution time?
thanks in advance,
arthur
"Arthur" <am*@gmx.infowr ote in message
news:47******** *************** ***********@r66 g2000hsg.google groups.com...
What do i have to do, so the file is available in the the directory
where the site is executed at execution time?
UNDER NO CIRCUMSTANCES do this!!!
Your file will be directly available to anyone by simply typing its URL e.g. http://www.mysite.com/mydata.xml
The place to store files like this is the App_Data folder.
--
Mark Rae
ASP.NET MVP http://www.markrae.net
Oopps as said in an earlier thread this is a very bad idea. c:\Program
Files\Microsoft Visual Studio 9.0\Common7\IDE is the path for your
development tool. It should be totally irrelevant to your application.
I would recommend starting fresh. Sites are usually stored in C:\Documents
and Settings\%profi le%\My documents\Visua l Studio 2008\WebSites
Plus I'm pretty sure you don't have the "copy if newer" option in a web
project...
You may want to restart fresh with more usual settings (are you sure you
don't use a windows project as an ASP.NET project ??)...
--
Patrice
"Arthur" <am*@gmx.info a écrit dans le message de groupe de discussion : 47************* *************** **...legroup s.com...
hi,
this might be a simple one to them who know:
i'm developing an asp.net project and use the debug mode. i have a xml
file which contains data, that shall be read, if a specific page is
run. when i build the project the file is correctly copied to the
build location (i selected "build action: none" and "copy if newer").
but when the project is run, the xml file is missing at the directory
from which the site is executed. it does not get copied there
automatically. in my case the directory where the site is executed is
"c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE \"
what do i have to do, so the file is available in the the directory
where the site is executed at execution time?
thanks in advance,
arthur
Hi,
thanks for your answers.
@juan & mark:
i put the file in the App_Data folder. now the folder gets copied to
the build location on compilation, but is still not available when
running the project on the local computer in debug mode. its just the
exception message changed from "file not found" to "folder not found".
@patrice:
it must be a webproject as it starts a local server and iexplorer to
view the site.
lets put it that way:
how would you add a content file, you want to read from a class that
is implemented in one of your websites? it should be in the project or
App_Data folder, i want to edit it there and it shall be avail at
runtime, when testing in debug mode on an local instance of iis. you
are surely not going to publish the whole site everytime you want to
test it while devloping, are you?
eg:
page_load in index.aspx.cs wants to open file "App_Data\conte nt.xml"
and read from it.
what do i have to do, that "content.xm l" is available in whatever
directory, the site is copied to, when running it locally by pressing
F5?
this has to be easy! - lol - if not, its typically microsoft :-)
re:
!how would you add a content file, you want to read from
!a class that is implemented in one of your websites?
DataSet mydata = new DataSet();
mydata.ReadXml( Server.MapPath( "~/App_Data/content.xml"));
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== ========
"Arthur" <am*@gmx.infowr ote in message news:d9******** *************** ***********@m36 g2000hse.google groups.com...
Hi,
thanks for your answers.
@juan & mark:
i put the file in the App_Data folder. now the folder gets copied to
the build location on compilation, but is still not available when
running the project on the local computer in debug mode. its just the
exception message changed from "file not found" to "folder not found".
@patrice:
it must be a webproject as it starts a local server and iexplorer to
view the site.
lets put it that way:
how would you add a content file, you want to read from a class that
is implemented in one of your websites? it should be in the project or
App_Data folder, i want to edit it there and it shall be avail at
runtime, when testing in debug mode on an local instance of iis. you
are surely not going to publish the whole site everytime you want to
test it while devloping, are you?
eg:
page_load in index.aspx.cs wants to open file "App_Data\conte nt.xml"
and read from it.
what do i have to do, that "content.xm l" is available in whatever
directory, the site is copied to, when running it locally by pressing
F5?
this has to be easy! - lol - if not, its typically microsoft :-)
Great,
Server.MapPath( "...") works for me.
Thanks very much!
Art
It's really confusing as it looks like you have to copy the site before
being able to run. Usually you don't have anything to deploy on your
developement machine. The site runs in place.
What if you switch to the built in development web server ? For example if
you add a blank page with Response.Write( Server.MapPath( "~")) it should
allow to show that the web site root is exactly the directory where files
are stored by the IDE...
For now it lloks like to me you have some kind of config that mandate a
deploy before being able to test your work whihc is not the usual setup...
You have to deploy only when putting your work on the production server not
when testing your work on a development machine...
--
Patrice
"Arthur" <am*@gmx.info a écrit dans le message de groupe de discussion : d9************* *************** **...legroup s.com...
Hi,
thanks for your answers.
@juan & mark:
i put the file in the App_Data folder. now the folder gets copied to
the build location on compilation, but is still not available when
running the project on the local computer in debug mode. its just the
exception message changed from "file not found" to "folder not found".
@patrice:
it must be a webproject as it starts a local server and iexplorer to
view the site.
lets put it that way:
how would you add a content file, you want to read from a class that
is implemented in one of your websites? it should be in the project or
App_Data folder, i want to edit it there and it shall be avail at
runtime, when testing in debug mode on an local instance of iis. you
are surely not going to publish the whole site everytime you want to
test it while devloping, are you?
eg:
page_load in index.aspx.cs wants to open file "App_Data\conte nt.xml"
and read from it.
what do i have to do, that "content.xm l" is available in whatever
directory, the site is copied to, when running it locally by pressing
F5?
this has to be easy! - lol - if not, its typically microsoft :-)
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Parzival |
last post by:
I have a package that includes some data files. I am planning to use a
distutils setup script to install the package. How can I compute a path
name for such a data file that will always be relative to my package
root directory (i.e. both when installed, and in my development directory?)
Or to rephrase, say the data file is mypkg/data/foo.dat relative to the
package root "mypkg" (the directory that holds __init__.py). Is there an
enquiry...
|
by: Khue Pham |
last post by:
Does anyone knows how to copy database from one server to another. By
copying I mean literally everything, not just the database. I know we
can dump the database from one server then reload it to another one.
However, I have a specific need for this and here is my problem:
I have my development server as of RedHat 9.0 and I install the
combination of LAMPS (Linux+Apache+MySQL+PHP+SSL). I configure it
works perfectly on my development...
|
by: Jake |
last post by:
I know how to copy files from one location to another but how would I go
about copying a file from one directory into serveral - or actually all
subdirectories in a single action? Some kind of loop?
Basically I want to be able to enter a filename into a text field and click
submit which would then copy the named file (which resides in the root
directory) into every subdirectory under the root (1 level only). Would be
helpful to be able...
|
by: Jacob |
last post by:
Really more of a VS.NET question than a C# question.... I have a couple
files in my solution that I would like copied to the compile directory when
the solution is built. How do I set it up so that everytime I build the
solution these files will automatically be copied into the same directory?
Thanks,
Jacob
|
by: Jon Asher |
last post by:
Hi,
I'm trying to do a simple import of a comma delimited text file with COPY
but it's returning an error. The file has been granted all permissions in
Linux, so it's not clear to me what the problem is. Version 7.41 is
installed... see below for details:
A comma delimited text file has been placed in a local directory with
permissions set to allow any user to read or write to it:
/root/Desktop/server_transfer/WorldPoints_v2.txt'
| |
by: mark_overstreet |
last post by:
I have a generic data layer DLL that expects to read its connection
string from it's own config file. The dll and config file have been
placed in the bin directory (VS.NET2005). However, due to shadow
copying, the config file does not get placed in the same directory as
the executing assembly at execution time.
For example, my data access DLL was copied to the following location
....
...
|
by: lumpybanana247 |
last post by:
when i use this script and choose "2" or "3" (in bold) it closes automatically, but "1" (underlined) doesn't
#include <fstream>
#include <iostream>
#include <iostream>
using namespace std;
int main()
{
char str;
|
by: ajc308 |
last post by:
I'm attempting to sort the <file>s within each <directory> in my XML according to their file extension, then write out the resulting sorted data back to XML format. I had it working before, and when I opened up the file the next day, the XSL behaved completely different. I don't know if I accidentally changed something, but I can't see any problems with my code.
My Sample XML:
<root name="PlanRepository">
<directory name="connoraj">...
|
by: foss |
last post by:
hi all,
I am not able to copy file from a directory in the server to another directory.
Here,
the source is outside the web root directory and the destination is inside the web root directory.
I got a warning
The code is as follows:
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |