Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > asp writes csv WITHOUT complete file path?

Reply
Thread Tools

asp writes csv WITHOUT complete file path?

 
 
Scott Gordo
Guest
Posts: n/a
 
      03-14-2006
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

 
Reply With Quote
 
 
 
 
Patrice
Guest
Posts: n/a
 
      03-14-2006
Server.MapPath ? Where do you want to write this file ? What is the security
risk you are trying to avoid ?

--
Patrice

"Scott Gordo" <> a écrit dans le message de
news: 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
>



 
Reply With Quote
 
 
 
 
Slim
Guest
Posts: n/a
 
      03-14-2006
have you considered server.mappath()
http://msdn.microsoft.com/library/de...4ca07b75e1.asp


"Scott Gordo" <> wrote in message
news: 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
>



 
Reply With Quote
 
Scott Gordo
Guest
Posts: n/a
 
      03-14-2006

Slim wrote:
> have you considered server.mappath()
> http://msdn.microsoft.com/library/de...4ca07b75e1.asp
>
>
> "Scott Gordo" <> wrote in message
> news: 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

 
Reply With Quote
 
Patrice
Guest
Posts: n/a
 
      03-14-2006
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" <> a écrit dans le message de
news: oups.com...
>
> Slim wrote:
> > have you considered server.mappath()
> >

http://msdn.microsoft.com/library/de...4ca07b75e1.asp
> >
> >
> > "Scott Gordo" <> wrote in message
> > news: 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
>



 
Reply With Quote
 
Scott Gordo
Guest
Posts: n/a
 
      03-15-2006

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" <> a écrit dans le message de
> news: oups.com...
> >
> > Slim wrote:
> > > have you considered server.mappath()
> > >

> http://msdn.microsoft.com/library/de...4ca07b75e1.asp
> > >
> > >
> > > "Scott Gordo" <> wrote in message
> > > news: 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
read CSV file using csv library Li Chen Ruby 18 03-23-2010 12:44 AM
read and write csv file using csv module jliu66 Python 0 10-19-2007 03:12 PM
How to move data from a CSV file to a JTable, and from a JTable to a CSV file ? Tintin92 Java 1 02-14-2007 06:51 PM
download writes html code to file =?Utf-8?B?QUNhdW50ZXI=?= ASP .Net 3 01-11-2005 07:29 PM
how adoStream writes from asp to asp.net? Ben ASP .Net 8 08-19-2004 08:18 AM



Advertisments