FileExists not supported??

Results 1 to 3 of 3

Thread: FileExists not supported??

  1. #1
    Chad Franklin Guest

    Default FileExists not supported??

    I tried your help system (http://www.4guysfromrolla.com/webtech/070799-2.shtml) and this is the error message I get...<BR>Microsoft VBScript runtime error &#039 800a01b6&#039 <BR>Object doesn&#039t support this property or method: &#039FileExists&#039 <BR>/test/Help_System/help.asp, line 39 <BR>What am I doing wrong?

  2. #2
    Join Date
    Dec 1969
    Posts
    2,849

    Default RE: FileExists not supported??

    Did you change any code? Show us line 39!! :)

  3. #3
    Chad Franklin Guest

    Default RE: FileExists not supported??

    I don&#039t think so??<BR><BR>help.asp<BR>&#060;%@ Language=VBScript &#037;&#062;<BR>&#060;% Option Explicit &#037;&#062;<BR>&#060;%<BR> &#039Expire!!<BR> Response.ExpiresAbsolute = Now() - 1<BR> <BR><BR> &#039The name of our help index file<BR> Const HelpIndex = "helpIndex.txt"<BR><BR> &#039FSO constants<BR> Const ForReading = 1<BR><BR> &#039We want to create one instance of a FileSystemObject<BR> Dim fso<BR> Set fso = Server.CreateObject("Scripting.FileSystemObject")< BR> <BR> &#039This will be our file textstream variable<BR> Dim fileTextStream<BR>&#037;&#062;<BR>&#060;html><BR>< BR>&#060;head><BR>&#060;title>&#060;/title><BR>&#060;/head><BR><BR>&#060;body><BR><BR>&#060;table WIDTH="100%" BORDER="0" CELLPADDING="3" HEIGHT="100%"><BR> &#060;tr><BR>&#060;!-- Left column, lists help topics --><BR> &#060;td WIDTH="25%" VALIGN="TOP" BGCOLOR="#CCCCCC">&#060;font FACE="Arial">&#060;ul><BR> &#060;li>&#060;a HREF="help.asp">Help Index&#060;/a><BR><BR>&#060;%<BR> &#039This will hold the URL and Title<BR> Dim strURL, strTitle<BR> <BR> &#039Make sure the text file exists<BR> If Not fso.FileExists(Server.MapPath(HelpIndex)) then<BR> &#039Tell the user we can&#039t find the help file...<BR> Response.Write "The help index file could not be located."<BR> else<BR> &#039Open our help index file and show links to all of our<BR> &#039help files... <BR> Set fileTextStream = fso.OpenTextFile(Server.MapPath(HelpIndex),ForRead ing)<BR> While Not fileTextStream.AtEndOfStream<BR> strTitle = fileTextStream.ReadLine<BR> strURL = fileTextStream.ReadLine<BR> <BR> Response.Write "&#060;LI>&#060;A HREF=""help.asp?" & strURL & """>" & _<BR> strTitle & "&#060;/A><BR>" & vbCrLf<BR> Wend<BR> fileTextStream.Close<BR> end if<BR> &#037;&#062; &#060;/font>&#060;/li><BR> &#060;/ul><BR> &#060;/td><BR> &#060;td WIDTH="*" VALIGN="TOP">&#060;p align="center">&#060;!-- Show the header you always want to appear, here... --> &#060;font SIZE="+2" FACE="Arial">&#060;b>Help System &#060;/b>&#060;/font>&#060;/p><BR> &#060;p>&#060;font FACE="Arial">&#060;%<BR> &#039Now, we need to determine what file to load<BR> Dim strFileName<BR> strFileName = Request.QueryString<BR> if Len(strFileName) = 0 then<BR> &#039No querystring passed in, show default index &#037;&#062; Welcome to the help system! Choose a topic you want help on from<BR> the list on the left! &#060;% else <BR> If Not fso.FileExists(Server.MapPath(strFileName)) then<BR> &#039Tell the user we can&#039t find the help file...<BR> Response.Write "The help file " & strFileName & " could not be located."<BR> else<BR> Set fileTextStream = fso.OpenTextFile(Server.MapPath(strFileName),ForRe ading)<BR> Response.Write fileTextStream.ReadAll<BR> end if<BR> end if<BR> &#037;&#062; &#060;/font>&#060;/td><BR> &#060;/tr><BR>&#060;/table><BR>&#060;/body><BR>&#060;/html><BR>&#060;%<BR> &#039Clean up<BR> Set fileTextStream = Nothing<BR> Set fso = Nothing<BR>&#037;&#062;<BR><BR>HelpIndex.txt<BR>Us ing the Response Object<BR>response.txt<BR>Using the Request Object<BR>request.txt<BR>Impressing your Friends with ASP<BR>impress.txt<BR>Opening Text Files with ASP<BR>textfiles.txt<BR><BR>Response.txt<BR>&#060; B>The Response Object:&#060;/B><BR><BR>The Response Object is ASP&#039s way of communicating with the HTML stream.<BR>If you want to send data to the HTML stream, you need to issue a<BR>&#060;CODE>Response.Write&#060;/CODE> statement, such as:<BR>&#060;P>&#060;BLOCKQUOTE>&#060;CODE><BR>Res ponse.Write "Hello, World!"<BR>&#060;/CODE>&#060;/BLOCKQUOTE>&#060;P><BR>Pretty easy, eh!?

Posting Permissions

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