Results 1 to 2 of 2

Thread: fso.OpenTextFile

  1. #1
    Join Date
    Oct 2011
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default fso.OpenTextFile

    Hello again,

    Ok, clearly I was clueless (I am referring to my "SOMETHING" post). I am not quite as lost although I have no idea WHY the following Classic ASP script will not simply write the value of <input type="text" value="firstname" /> to a text file. Take this:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>

    <title>TextBox Process Test</title>

    </head>
    <body>
    </br>
    &nbsp; <form action="FirstNameTest.asp" method="Post">
    &nbsp; First Name: <input type="text" name="firstname" />
    &nbsp; <input type="submit" value="Submit" />
    &nbsp; <input type="reset" value="Clear" />
    &nbsp;
    </body>
    </html>


    That is called FirstNamePage.asp. The following is FirstNameTest.asp:


    THIS PART WORKS

    <%
    Option Explicit
    Dim firstname
    firstname = Request.Form("firstname")
    response.write firstname

    ' If I add the following lines, the response.write still works:

    Dim fso, txtfile, objFile

    textfile = "C:\Inetpub\wwwroot\FolderName\FirstName.txt"
    Set fso = Server.CreateObject("Scripting.FileSystemObject")

    ' AS SOON AS I TRY TO OPEN THE TEXTFILE, I GET ERROR HTTP 500

    Set objFile = fso.OpenTextFile(txtfile, 8, True)
    objFile.WriteLine firstname
    objFile.Close
    Set objFile = nothing
    Set fso = nothing

    %>

    Will someone PLEASE help me... pretty please

  2. #2
    Join Date
    Oct 2011
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default HTTP Error 500

    Hello,

    I really wish somone would have responded. I was in a for too long

    HTTP Error 500 is because I had friendly error messages checked in the Advanced Tab of the Internet Options dialog box. I had come acrross that bit of information before (months ago) and had forgotten all about it.

    After getting descriptive debugging information, I was able to get my script to work.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •