Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Asp help

Asp help

Scheduled Pinned Locked Moved ASP.NET
questionsysadminhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Larsson
    wrote on last edited by
    #1

    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?

    M 1 Reply Last reply
    0
    • L Larsson

      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?

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups