473,398 Members | 2,088 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,398 software developers and data experts.

asp writes csv WITHOUT complete file path?

I have a simple asp form which writes to a csv.
The code it's based on (from "ASP for Dummies") is:

Set peoplefile - _
filesys.OpenTextFile( _
"c:\inetpub\wwwroot\gb\gbpeople.txt",1)

The form is going live soon, and I'd like just a dash of due diligence
in terms of security. I tried using a relative link to the gbpeople.txt
file which didn't work. Is there a better way around this without
reinventing?

Much thanks,

Scott

Mar 14 '06 #1
5 1821
Server.MapPath ? Where do you want to write this file ? What is the security
risk you are trying to avoid ?

--
Patrice

"Scott Gordo" <bl*********@gmail.com> a écrit dans le message de
news:11**********************@j33g2000cwa.googlegr oups.com...
I have a simple asp form which writes to a csv.
The code it's based on (from "ASP for Dummies") is:

Set peoplefile - _
filesys.OpenTextFile( _
"c:\inetpub\wwwroot\gb\gbpeople.txt",1)

The form is going live soon, and I'd like just a dash of due diligence
in terms of security. I tried using a relative link to the gbpeople.txt
file which didn't work. Is there a better way around this without
reinventing?

Much thanks,

Scott

Mar 14 '06 #2
have you considered server.mappath()
http://msdn.microsoft.com/library/de...4ca07b75e1.asp
"Scott Gordo" <bl*********@gmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
I have a simple asp form which writes to a csv.
The code it's based on (from "ASP for Dummies") is:

Set peoplefile - _
filesys.OpenTextFile( _
"c:\inetpub\wwwroot\gb\gbpeople.txt",1)

The form is going live soon, and I'd like just a dash of due diligence
in terms of security. I tried using a relative link to the gbpeople.txt
file which didn't work. Is there a better way around this without
reinventing?

Much thanks,

Scott

Mar 14 '06 #3

Slim wrote:
have you considered server.mappath()
http://msdn.microsoft.com/library/de...4ca07b75e1.asp
"Scott Gordo" <bl*********@gmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
I have a simple asp form which writes to a csv.
The code it's based on (from "ASP for Dummies") is:

Set peoplefile - _
filesys.OpenTextFile( _
"c:\inetpub\wwwroot\gb\gbpeople.txt",1)

The form is going live soon, and I'd like just a dash of due diligence
in terms of security. I tried using a relative link to the gbpeople.txt
file which didn't work. Is there a better way around this without
reinventing?

Much thanks,

Scott


I should have mentioned that I'm a hack cluebie....
It looks like exactly what I'm looking for, but I'm not sure how to
combine the two.

My code looks like:
<%...
Dim filesys, mgrfile
Set filesys = CreateObject("Scripting.FileSystemObject")
Set mgrfile = _
filesys.OpenTextFile(_
"C:\Inetpub\yadayada\contestants.csv",_
8, true)
....%>

Microsoft's:
<%=
Server.MapPath(Request.ServerVariables("PATH_INFO" ))%>

I figure it's something like
Set mgrfile =
Server.MapPath(Request.ServerVariables("contestant s.csv", 8, true))?

Can I get an amen?

Thanks again.

Scott

Mar 14 '06 #4
Server.MapPath maps a virtual path (such as
"/myfolder/subfolder/myfile.txt") to a physical path
("c:\mysites\thisapp\myfolder\subfolder\myfile.txt ").

ServerVariables allows to retrieve some server defined variables (such as
the path to the current path). The Microsoft sample does likely something
like displaying the physical path of the current page.

In your case try Request.ServerMapPath("/whereyouwanttostore/yourfile.txt")

--
Patrice

"Scott Gordo" <bl*********@gmail.com> a écrit dans le message de
news:11**********************@u72g2000cwu.googlegr oups.com...

Slim wrote:
have you considered server.mappath()
http://msdn.microsoft.com/library/de...4ca07b75e1.asp

"Scott Gordo" <bl*********@gmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
I have a simple asp form which writes to a csv.
The code it's based on (from "ASP for Dummies") is:

Set peoplefile - _
filesys.OpenTextFile( _
"c:\inetpub\wwwroot\gb\gbpeople.txt",1)

The form is going live soon, and I'd like just a dash of due diligence
in terms of security. I tried using a relative link to the gbpeople.txt file which didn't work. Is there a better way around this without
reinventing?

Much thanks,

Scott


I should have mentioned that I'm a hack cluebie....
It looks like exactly what I'm looking for, but I'm not sure how to
combine the two.

My code looks like:
<%...
Dim filesys, mgrfile
Set filesys = CreateObject("Scripting.FileSystemObject")
Set mgrfile = _
filesys.OpenTextFile(_
"C:\Inetpub\yadayada\contestants.csv",_
8, true)
...%>

Microsoft's:
<%=
Server.MapPath(Request.ServerVariables("PATH_INFO" ))%>

I figure it's something like
Set mgrfile =
Server.MapPath(Request.ServerVariables("contestant s.csv", 8, true))?

Can I get an amen?

Thanks again.

Scott

Mar 14 '06 #5

Patrice wrote:
Server.MapPath maps a virtual path (such as
"/myfolder/subfolder/myfile.txt") to a physical path
("c:\mysites\thisapp\myfolder\subfolder\myfile.txt ").

ServerVariables allows to retrieve some server defined variables (such as
the path to the current path). The Microsoft sample does likely something
like displaying the physical path of the current page.

In your case try Request.ServerMapPath("/whereyouwanttostore/yourfile.txt")

--
Patrice

"Scott Gordo" <bl*********@gmail.com> a écrit dans le message de
news:11**********************@u72g2000cwu.googlegr oups.com...

Slim wrote:
have you considered server.mappath()
http://msdn.microsoft.com/library/de...4ca07b75e1.asp

"Scott Gordo" <bl*********@gmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
>I have a simple asp form which writes to a csv.
> The code it's based on (from "ASP for Dummies") is:
>
> Set peoplefile - _
> filesys.OpenTextFile( _
> "c:\inetpub\wwwroot\gb\gbpeople.txt",1)
>
> The form is going live soon, and I'd like just a dash of due diligence
> in terms of security. I tried using a relative link to the gbpeople.txt > file which didn't work. Is there a better way around this without
> reinventing?
>
> Much thanks,
>
> Scott
>


I should have mentioned that I'm a hack cluebie....
It looks like exactly what I'm looking for, but I'm not sure how to
combine the two.

My code looks like:
<%...
Dim filesys, mgrfile
Set filesys = CreateObject("Scripting.FileSystemObject")
Set mgrfile = _
filesys.OpenTextFile(_
"C:\Inetpub\yadayada\contestants.csv",_
8, true)
...%>

Microsoft's:
<%=
Server.MapPath(Request.ServerVariables("PATH_INFO" ))%>

I figure it's something like
Set mgrfile =
Server.MapPath(Request.ServerVariables("contestant s.csv", 8, true))?

Can I get an amen?

Thanks again.

Scott


I wound up using your guidance and getting a little help. For the sake
of reference, I used:

Set sampleObject =
otherObject.CreateTextFile((Server.MapPath("folder/file_name.txt")),
True)

It's working. Thanks for your help.

Scott

Mar 15 '06 #6

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

Similar topics

15
by: (Pete Cresswell) | last post by:
I've got a .BAT file that I use for executing various MS Access apps that I wrote way back in the days of 2.0. It's evolved over time, but it still contains a number of possible paths to...
4
by: nan | last post by:
Hi all. Anyone has an idea of how to open a file without know the complete name of it, without opening the directory (with opendir) and test each file? For example, I have this: ...
12
by: Anders Eriksson | last post by:
Hello! I'm trying to create a program that will watch a directory and when a file is created print that file. I have used FileSystemWatcher for watching the directory and I get an created event....
4
by: sunilj20 | last post by:
Hello, I have a requirement wherein, a user clicks on a file name in an ASP.NET web application, and the file should automatically be downloaded (Without showing the "Open", "Save As") in the...
4
by: Randall Parker | last post by:
XP Home does not come with IIS. Can one use VS 2003 or some other tool to view aspx pages one is developing and do that on XP Home without having IIS on the machine?
6
by: Neo Geshel | last post by:
About 4 months ago I came across this one web page that talked about streaming raw image data (from a database, for example) directly to a web page without requiring a secondary ASPX page to...
38
by: ted | last post by:
I have an old link that was widely distributed. I would now like to put a link on that old page that will go to a new page without displaying anything.
1
by: pavanip | last post by:
hi, I have an application that will find Firefox browing history, Auto complete datalist, Temp offline files and Find Computer list. please give me some idea on Auto complete datalist, Temp offline...
1
by: indu19 | last post by:
Hi, I am still fresher in php. so i need help... How to get upload file's complete path and how to store it in DB move_uploaded_file($_FILES,"c:/Indu/".$_FILES); I upload file using...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
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...
0
agi2029
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,...
0
isladogs
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...

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.