Asp help
-
Hello, I posted a message here before and I dont now if this is the right forum for me byt the question that I need help with is this. I have this code. This code shown all the image file I have but I need to rean in the textfile to. <% Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFolder(Server.MapPath("/test/")) Set fc = f.Files For Each f1 in fc if right(lcase(f1.name),4) = ".gif" then Response.Write("
") Next %> And I want to read in a textfile with the same namn but is not a *.gif its a *.txt file. This is the response I get. foreach (string s in System.IO.Directory.GetFiles(@"c:\dir", "*.gif")) { string txtPath = s.Substring(0, s.Length - 3) + "txt"; System.IO.TextReader tr = new System.IO.StreamReader(txtPath); string text = tr.ReadToEnd(); tr.Close(); } Now how can I make this work. I need to show the image and then the text after the image. There can be many image and text files so I dont now how I should do it. Is there a king on asp that can help med with this? -
Hello, I posted a message here before and I dont now if this is the right forum for me byt the question that I need help with is this. I have this code. This code shown all the image file I have but I need to rean in the textfile to. <% Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFolder(Server.MapPath("/test/")) Set fc = f.Files For Each f1 in fc if right(lcase(f1.name),4) = ".gif" then Response.Write("
") Next %> And I want to read in a textfile with the same namn but is not a *.gif its a *.txt file. This is the response I get. foreach (string s in System.IO.Directory.GetFiles(@"c:\dir", "*.gif")) { string txtPath = s.Substring(0, s.Length - 3) + "txt"; System.IO.TextReader tr = new System.IO.StreamReader(txtPath); string text = tr.ReadToEnd(); tr.Close(); } Now how can I make this work. I need to show the image and then the text after the image. There can be many image and text files so I dont now how I should do it. Is there a king on asp that can help med with this?Hi there, Looks like you want to convert the .net code of reading text files into vb script and put it inside the For Each statement of the classic ASP code. The documentation of the FileSystemObject may give you some hints: FileSystemObject Sample Code [^] Also, the Web Development[^] is the right room for the classic ASP questions, and here is for the ASP.NET.