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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. opening a file n reading it

opening a file n reading it

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netsysadminhelpquestion
6 Posts 3 Posters 1 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.
  • A Offline
    A Offline
    ahsan2011
    wrote on last edited by
    #1

    hii...i m trying to open a file in asp.net(C#).. here how my code looks like.. string maulik =Server.MapPath("maulik.txt"); StreamReader sr = File.OpenText("C:\\maulik.txt"); string contents = sr.ReadToEnd(); Label2.Text=contents; sr.Close(); this works fine...but have to provide a filename... how can i open a random file using a dialog box and then read it... help required urgently

    G 1 Reply Last reply
    0
    • A ahsan2011

      hii...i m trying to open a file in asp.net(C#).. here how my code looks like.. string maulik =Server.MapPath("maulik.txt"); StreamReader sr = File.OpenText("C:\\maulik.txt"); string contents = sr.ReadToEnd(); Label2.Text=contents; sr.Close(); this works fine...but have to provide a filename... how can i open a random file using a dialog box and then read it... help required urgently

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      What exactly is it that you need help with? Opening the dialog box? Getting the file name from the dialog box? Using the file name in the code that reads the file?

      --- single minded; short sighted; long gone;

      A 1 Reply Last reply
      0
      • G Guffa

        What exactly is it that you need help with? Opening the dialog box? Getting the file name from the dialog box? Using the file name in the code that reads the file?

        --- single minded; short sighted; long gone;

        A Offline
        A Offline
        ahsan2011
        wrote on last edited by
        #3

        i dont want to specify a file name but open a file to read while browsing 4 it...n opening it

        G 1 Reply Last reply
        0
        • A ahsan2011

          i dont want to specify a file name but open a file to read while browsing 4 it...n opening it

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          What exactly is it that you need help with? Opening the dialog box? Getting the file name from the dialog box? Using the file name in the code that reads the file?

          --- single minded; short sighted; long gone;

          A 1 Reply Last reply
          0
          • G Guffa

            What exactly is it that you need help with? Opening the dialog box? Getting the file name from the dialog box? Using the file name in the code that reads the file?

            --- single minded; short sighted; long gone;

            A Offline
            A Offline
            ahsan2011
            wrote on last edited by
            #5

            need to open a file using a dialog box...

            V 1 Reply Last reply
            0
            • A ahsan2011

              need to open a file using a dialog box...

              V Offline
              V Offline
              Vasudevan Deepak Kumar
              wrote on last edited by
              #6

              ahsan2011 wrote:

              need to open a file using a dialog box...

              ASP.NET is serverside. However, you have HtmlInputFile to lend you little help.

              Vasudevan Deepak Kumar Personal Homepage Tech Gossips

              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