Reading  a  text file from ASP

Posted on 1999-01-29
Last Modified: 2010-04-09
Dear Friends
     Can I read a text file from my ASP
I have to take each string from the file till the EOF.
I need ASP code with explanation
Question by:jimevans
  • 2
LVL 10

Accepted Solution

MasseyM earned 20 total points
ID: 1845822
  Dim fso, f, f1, fc, s
  Set fso = CreateObject("Scripting.FileSystemObject")
      TheFile = Server.MapPath(Request.ServerVariables("SCRIPT_NAME"))
      loc = InStrRev(TheFile,"\")
      TheFile = Left(TheFile,loc)
  Set f = fso.GetFolder(TheFile)
  Set fc = f.Files
Set TitleFile = fso.OpenTextFile(TheFile & "yourfile.txt")
TextBuffer = TitleFile.ReadAll

this will read the entire file into the "TextBuffer" variable.

Expert Comment

ID: 1845823
Why did you delete "Getting a value from a listbox"? Because my solution worked?


Author Comment

ID: 1845824
Thanks MasseyM
your code works good

Martin I have already tried the ways you have
sugessted before I posted that question. Then used a different method to solve that problem. Please dont feel bad in this issue

Expert Comment

ID: 1845825
Just being curious...How did you do?


Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Scrolling the scrollbar in a list in html 9 48 mvc foreach 3 34
Help position a graphic properly via CSS 4 23
Hyper V cluster 2 31
This article discusses four methods for overlaying images in a container on a web page
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now