473,322 Members | 1,522 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Best approach - writing text file

Hi all,

Ok - minor fly in my ointment...

I have an application which was successfully writing data from submitted
forms to a text file in a directory - in this case:

/data/findata.txt

This was fine because the forms lived at the root level with this directory.

Since then I have added enabled the forms to be used on subdirectories :

/subdirectory/myform.asp

I've used the same code for server.mapparth("data") etc - but instead of
locating the directory at the root of the server called "data" it looks to
the current directory- doesn't find it and creates another! eek!

What I need is a way to say "right, it doesnt matter what level you are at
at the moment, always look at the root level /data directory"...

This has to be fairly dynamic - on the development server here its got a
different file structure than on the live server (ie, it lives another level
down again on the physical drive)...

Anyone got a good idea on how to look back up?

I do have one way to test which level they are at - but I feel that its a
bit 'weak' - I have an ID that tells me if they are working on the upper or
lower levels (ie, anything other than 1 is a lower level) - whilst I realise
I could use this in the test I'm not sure if its going to be 100% fool proof
to base this criteria on this ID.

Therefore I was hoping for a better way using the server.mappath etc...

Thanks in advance for any help.

Regards

Rob
Jul 19 '05 #1
4 2036


Rob Meade wrote:
Hi all,

Ok - minor fly in my ointment...

I have an application which was successfully writing data from submitted
forms to a text file in a directory - in this case:

/data/findata.txt

This was fine because the forms lived at the root level with this directory.

Since then I have added enabled the forms to be used on subdirectories :

/subdirectory/myform.asp

I've used the same code for server.mapparth("data") etc - but instead of
locating the directory at the root of the server called "data" it looks to
the current directory- doesn't find it and creates another! eek!

What I need is a way to say "right, it doesnt matter what level you are at
at the moment, always look at the root level /data directory"...


So you want
Server.MapPath("/data")
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 19 '05 #2
"Martin Honnen" wrote ...
So you want
Server.MapPath("/data")


Hi Martin,

Thanks for your reply - the / looks 'anywhere' then does it?

Incidently - if I had more than one data directory - how would it know which
to return as correct? Or would it just return the last one it finds?

Cheers

Rob
Jul 19 '05 #3


Rob Meade wrote:
"Martin Honnen" wrote ...

So you want
Server.MapPath("/data")

Hi Martin,

Thanks for your reply - the / looks 'anywhere' then does it?

Incidently - if I had more than one data directory - how would it know which
to return as correct? Or would it just return the last one it finds?


No, / is the root of the virtual server directory structure and
Server.MapPath("/data")
looks for a data directly under the root.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 19 '05 #4
"Martin Honnen" wrote ...
No, / is the root of the virtual server directory structure and
Server.MapPath("/data")
looks for a data directly under the root.


Hi Martin,

Many thanks for your reply - I will give that a go...

Thanks again,

Rob
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
by: Stuart Gerchick | last post by:
C++ Coding Standards : 101 Rules, Guidelines, and Best Practices by Herb Sutter, Andrei Alexandrescu is now a month or so away from release. What is people's opinion on this...is it going to be a...
136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
1
by: Andy Britcliffe | last post by:
Hi I'm faced with the situation where I could have a single physical file that could contain multiplie XML documents e.g file.txt contains the following: <?xml version="1.0"...
4
by: Greg Linwood | last post by:
I am wondering what the best approach to binding XML data to an asp:Table from the Page_Load event in a code behind module? I'm using VB.Net and initially approached this by adding a table to the...
16
by: Rex | last post by:
Hi All - I have a question that I think MIGHT be of interest to a number of us developers. I am somewhat new to VIsual Studio 2005 but not new to VB. I am looking for ideas about quick and...
1
by: Shawn Ferguson | last post by:
Hello All, Before I starting writing the code, I would like to figure out what the best approach to this problem would be. I want to create a process that imports a text file (Pipe | delimited),...
5
by: gw7rib | last post by:
I'm writing a program which has "notes" - these can appear on the screen as windows with text in. It is possible to create an "index note" - at present, this will contain a list of the titles (or...
12
by: Jeff | last post by:
I need to read about 100 lines of a csv file into memory. Each line contains 6 fields. What is the best way to store this into memory and then read it back. Is a array of a multi- dimsion...
10
by: Brendan Miller | last post by:
What would heavy python unit testers say is the best framework? I've seen a few mentions that maybe the built in unittest framework isn't that great. I've heard a couple of good things about...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.