Read a text file in ASP.NET

The System.IO namespace contains the StreamReader class allow reading of files.
You can then read the entire contents of the text file into a string, by using ReadToEnd() method.
Remmber to close the StreamReader using the Close() method when finished.

 <!DOCTYPE html>

<script runat="server">

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim sr As New System.IO.StreamReader(Server.MapPath("test.txt"))
        Dim sContent As String = sr.ReadToEnd
        sr.Close()
        Response.Write(sContent)
    End Sub

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Button ID="Button1" runat="server" Text="Button" />
    </div>
    </form>
</body>
</html>
Updated: March 6, 2015 — 4:59 pm

Comments

Add a Comment
  1. Your comment is awaiting moderation.

    Regards. Ample postings!

    https://www.cialismim.com/
    cialis preço original
    cheap cialis
    preços de viagra cialis e levitra
    cialis 20 mg

  2. Your comment is awaiting moderation.

    Seriously a lot of superb knowledge.
    http://cialispego.com/
    frequency of taking cialis
    cialis without a doctor prescription
    cialis price in pakistan
    cialis without a doctor prescription

  3. Your comment is awaiting moderation.

    You actually reported this perfectly!
    https://www.cialisfidel.com/
    cialis irritability
    cialis without a doctor prescription
    cialis canada drugs
    cialis 20mg

  4. Your comment is awaiting moderation.

    Thank you. Numerous stuff!

    http://cialismsnrx.com/
    cialis 10 mg betegtГЎjГ©koztatГі
    buy cialis online
    cialis side effects wikipedia
    cialis 20mg

  5. Your comment is awaiting moderation.

    Good material. Thanks a lot!
    http://cialisttk.com/
    cuanto tiempo dura efecto cialis
    buy cialis online
    forum sur cialis 5mg
    cialis generic

  6. Your comment is awaiting moderation.

    Kudos. A lot of stuff.

    https://www.cialisfidel.com/
    prilosec cialis interaction
    cialis 20mg
    cialis pretul
    buy cialis online

  7. Your comment is awaiting moderation.

    Many thanks! Lots of tips!

    https://www.cialisfidel.com/
    cialis generique france pharmacie
    generic cialis
    cialis normal dosage
    cialis 20 mg

  8. Your comment is awaiting moderation.

    Terrific posts. Many thanks!
    http://cialispego.com/
    cialis hver dag
    cheap cialis
    viagra cialis levitra dose comparison
    cialis without a doctor prescription

  9. Your comment is awaiting moderation.

    Good postings. Thank you.
    http://cialismsnrx.com/
    cialis herbal supplements
    cialis 20mg
    what happens when cialis expires
    cialis 20 mg

  10. Your comment is awaiting moderation.

    You’ve made your point!
    http://cialismsnntx.com/
    cialis compensat
    cialis online
    legit online pharmacy cialis
    cialis generic

  11. Your comment is awaiting moderation.

    Useful write ups. Many thanks!
    http://cialisttk.com/
    definition de cialis
    cialis without a doctor prescription
    cialis wieder absetzen
    cheap cialis

  12. Your comment is awaiting moderation.

    Cheers. Loads of advice.

    http://cialisttk.com/
    cialis rezeptfrei aus holland
    cialis without a doctor prescription
    farmacia online cialis 5 mg
    cialis online

  13. Your comment is awaiting moderation.

    Nicely put. Appreciate it!
    http://cialismsnrx.com/
    cialis 30 tablet fiyatД±
    cialis online
    cialis for the treatment of bph
    cialis 20 mg

  14. Your comment is awaiting moderation.

    Many thanks. Lots of data.

    http://cialispego.com/
    que medicamentos contienen cialis
    cialis online
    cialis 5mg boite de 28 prix
    cialis generic

  15. Your comment is awaiting moderation.

    Thank you! Very good information.
    http://cialismsnntx.com/
    il prend du cialis en cachette
    cialis online
    wat werkt beter cialis of viagra
    cheap cialis

  16. Your comment is awaiting moderation.

    Kudos! Ample stuff!

    http://cialispego.com/
    herbal cialis herbal alternatives
    cialis 20mg
    distributor cialis di indonesia
    cialis 20mg

  17. Your comment is awaiting moderation.

    You said it very well.
    http://cialisttk.com/
    can you take aspirin and cialis
    cheap cialis
    cialis online packstation
    cheap cialis

  18. Your comment is awaiting moderation.

    Thanks! Very good information!
    http://cialispego.com/
    cialis patent generic
    cheap cialis
    what gets you harder viagra or cialis
    cialis 20mg

  19. Your comment is awaiting moderation.

    Fantastic info. Kudos!
    http://cialismsnntx.com/
    ja usei cialis
    cialis 20 mg
    dove si vende il cialis
    cheap cialis

  20. Your comment is awaiting moderation.

    Thank you! Ample write ups.

    https://www.cialismim.com/
    cialis par correspondance
    cialis 20 mg
    viagra cialis espaГ±a
    cialis 20 mg

  21. Your comment is awaiting moderation.

    Point certainly taken!.
    https://www.cialismim.com/
    como atua o cialis
    cialis online
    cialis efeito colateral
    cialis generic

  22. Your comment is awaiting moderation.

    Regards! I appreciate it.
    http://cialismsnntx.com/
    costo de la caja de cialis
    buy cialis online
    anthem cialis
    buy cialis online

  23. Your comment is awaiting moderation.

    Kudos! Lots of data.

    http://cialisttk.com/
    cialis super active funziona
    cialis 20mg
    cialis bestellen nachnahme
    cialis online

  24. Your comment is awaiting moderation.

    Excellent forum posts. Many thanks!
    https://www.cialisfidel.com/
    eli lilly cialis sales
    cialis 20mg
    forum levitra cialis viagra
    cialis 20 mg

  25. Your comment is awaiting moderation.

    You made your point very clearly!!
    http://cialispego.com/
    cialis 20mg fta 8st
    cialis 20 mg
    cialis muestras gratis
    cialis 20mg

  26. Your comment is awaiting moderation.

    You said it nicely..
    https://www.cialismim.com/
    buy cialis overnight delivery
    cheap cialis
    pentru ce este bun cialis
    cialis 20 mg

  27. Your comment is awaiting moderation.

    Cheers. Useful stuff!
    http://cialisttk.com/
    kamagra cialis bestellen
    generic cialis
    wie cialis teilen
    generic cialis

  28. Your comment is awaiting moderation.

    Truly quite a lot of beneficial knowledge.
    http://cialismsnntx.com/
    cipla cialis online
    generic cialis
    cialis once a day cost
    cheap cialis

  29. Your comment is awaiting moderation.

    Thanks a lot, I value this.
    https://www.cialismim.com/
    cialis daily 5mg reviews
    cialis online
    bathtubs and cialis
    generic cialis

  30. Your comment is awaiting moderation.

    You said it perfectly.!
    http://cialispego.com/
    cialis tablett 10 mg lilly
    cialis generic
    costo compresse cialis
    cialis 20 mg

  31. Your comment is awaiting moderation.

    You’ve made your stand pretty effectively!!
    http://cialispego.com/
    cialis citalopram
    cialis online
    cialis 2.5 effets secondaires
    buy cialis online

  32. Your comment is awaiting moderation.

    Many thanks, I enjoy it.
    http://cialispego.com/
    cialis guatemala
    generic cialis
    cialis congiuntivite
    cialis online

  33. Your comment is awaiting moderation.

    Nicely put. Thank you!
    http://cialismsnntx.com/
    can you mix vicodin and cialis
    generic cialis
    prix du cialis 20 en pharmacie
    cialis generic

  34. Your comment is awaiting moderation.

    Thanks a lot. A good amount of posts.

    https://www.cialismim.com/
    cialis mit alkohol
    generic cialis
    meglio il levitra o il cialis
    cialis online

  35. Your comment is awaiting moderation.

    Amazing material, Kudos.
    http://cialismsnrx.com/
    cialis dijual bebas
    cialis 20mg
    cialis professional vs cialis super active
    cheap cialis

  36. Your comment is awaiting moderation.

    You revealed that very well!
    https://www.cialisfidel.com/
    wie lange hält die wirkung von cialis an
    cialis 20 mg
    cialis sirve
    cialis generic

  37. Your comment is awaiting moderation.

    Perfectly expressed genuinely! !
    http://cialisttk.com/
    c quoi le cialis
    cialis without a doctor prescription
    cialis sehr gГјnstig
    buy cialis online

  38. Your comment is awaiting moderation.

    Wow quite a lot of excellent knowledge.
    http://cialispego.com/
    wo kann man cialis generika kaufen
    buy cialis online
    cialis prostate treatment
    cialis without a doctor prescription

  39. Your comment is awaiting moderation.

    Well expressed really. !
    http://cialispego.com/
    cialis 5 mg effetto immediato
    buy cialis online
    cialis 20mg fta 12
    cheap cialis

  40. Your comment is awaiting moderation.

    Nicely put. Thank you!
    http://cialisttk.com/
    cialis precio en farmatodo
    cialis online
    cialis preise in frankreich
    cheap cialis

  41. Your comment is awaiting moderation.

    Wow many of terrific material!
    https://www.cialisfidel.com/
    fake cialis toronto
    generic cialis
    will cialis lower your blood pressure
    cialis without a doctor prescription

  42. Your comment is awaiting moderation.

    With thanks. Ample knowledge!

    https://www.cialismim.com/
    comprar cialis online seguro
    buy cialis online
    can you consume alcohol while taking cialis
    buy cialis online

  43. Your comment is awaiting moderation.

    You expressed this perfectly.
    http://cialisttk.com/
    en ucuz cialis 20 mg
    cialis 20mg
    comprar cialis barata
    cialis 20 mg

  44. Your comment is awaiting moderation.

    Many thanks, Useful information.
    http://cialisttk.com/
    cialis review webmd
    cialis generic
    how much is cialis in dubai
    cialis without a doctor prescription

  45. Your comment is awaiting moderation.

    You’ve made your point!
    http://cialisttk.com/
    domande e risposte sul cialis
    cialis without a doctor prescription
    cialis vilniuje
    generic cialis

  46. Your comment is awaiting moderation.

    Fantastic postings. Kudos.
    http://cialisttk.com/
    what mg cialis should i take
    cialis generic
    cialis effect blood pressure
    buy cialis online

  47. Your comment is awaiting moderation.

    Thanks a lot! I value it!
    http://cialispego.com/
    qual melhor levitra viagra ou cialis
    cialis generic
    cialis jak stosowac
    cialis online

  48. Your comment is awaiting moderation.

    You’ve made your point!
    https://www.cialismim.com/
    tagliare il cialis
    cialis 20 mg
    cialis 2.5 mg opinioni
    generic cialis

  49. Your comment is awaiting moderation.

    This is nicely put. !
    https://www.cialismim.com/
    prix cialis quebec
    cheap cialis
    what is better cialis levitra or viagra
    cialis online

  50. Your comment is awaiting moderation.

    Nicely voiced genuinely. !
    http://cialismsnrx.com/
    cialis wie teilen
    buy cialis online
    chi non deve prendere il cialis
    cialis 20mg

  51. Your comment is awaiting moderation.

    Cheers! Quite a lot of content.

    http://cialismsnntx.com/
    can you take cialis two days in a row
    generic cialis
    effet cialis 5mg
    buy cialis online

  52. Your comment is awaiting moderation.

    With thanks! Ample content!

    http://cialismsnntx.com/
    can you split a 20mg cialis
    cheap cialis
    cialis made me like a donkey
    generic cialis

  53. Your comment is awaiting moderation.

    Valuable advice. With thanks.
    http://cialismsnrx.com/
    cialis generic fast shipping
    cheap cialis
    cialis drug reviews
    cialis online

  54. Your comment is awaiting moderation.

    Nicely put, Kudos!
    http://cialispego.com/
    does cialis keep you hard after ejaculation
    cialis 20 mg
    cialis neden baЕџ aДџrД±sД± yapar
    cialis 20mg

  55. Your comment is awaiting moderation.

    You made your point!
    https://www.cialismim.com/
    cialis canada en ligne
    cialis generic
    cialis generic in india
    cialis 20 mg

  56. Your comment is awaiting moderation.

    Fantastic knowledge. Thank you.
    http://cialismsnrx.com/
    cialis alternative naturali
    cheap cialis
    comprar cialis en mГ©xico
    cialis 20mg

  57. Your comment is awaiting moderation.

    You actually stated that perfectly!
    http://cialisttk.com/
    cialis blutdrucksenkende mittel
    cialis online
    cialis daily for blood pressure
    cheap cialis

  58. Your comment is awaiting moderation.

    Cheers, Wonderful information.
    https://www.cialismim.com/
    20 mg cialis effects
    generic cialis
    cialis virkningstid
    cialis 20mg

  59. Your comment is awaiting moderation.

    Really quite a lot of beneficial material.
    https://www.cialisfidel.com/
    para k sirve la pastilla cialis
    cialis without a doctor prescription
    enalapril maleate and cialis
    cialis generic

  60. Your comment is awaiting moderation.

    You have made your point quite effectively..
    http://cialismsnntx.com/
    cialis satan eczaneler adana
    cialis generic
    cialis professional wikipedia
    cheap cialis

  61. Your comment is awaiting moderation.

    Wonderful data, Appreciate it.
    http://cialismsnrx.com/
    grapefruit juice with cialis
    cialis 20mg
    is cialis covered by united healthcare
    cialis 20mg

  62. Your comment is awaiting moderation.

    Thanks, An abundance of stuff!

    http://cialispego.com/
    cialis 10 mg andorra
    cialis generic
    cialis australia paypal
    cialis online

  63. Your comment is awaiting moderation.

    You expressed it exceptionally well.
    http://cialismsnrx.com/
    cialis cuanto tomar
    cialis generic
    dosis minum cialis
    cialis without a doctor prescription

  64. Your comment is awaiting moderation.

    You have made your position very well!.
    http://cialismsnrx.com/
    is there a difference between cialis and generic cialis
    cialis generic
    cialis con red bull
    generic cialis

  65. Your comment is awaiting moderation.

    This is nicely expressed! .
    http://cialismsnntx.com/
    cialis ativan
    cialis online
    buy generic cialis eu
    cialis generic

  66. Your comment is awaiting moderation.

    Thanks a lot, Very good stuff!
    http://cialispego.com/
    cialis 4 stГјck preisvergleich
    cialis without a doctor prescription
    cialis packungsgroessen
    cialis generic

  67. Your comment is awaiting moderation.

    You actually said this really well!
    http://cialispego.com/
    is cialis approved for bph in canada
    cheap cialis
    comprar cialis online fiable
    cialis online

  68. Your comment is awaiting moderation.

    Reliable posts. Cheers!
    http://cialismsnrx.com/
    indische cialis generika
    generic cialis
    can you buy cialis at walmart
    cialis without a doctor prescription

  69. Your comment is awaiting moderation.

    Fantastic data. Cheers!
    http://cialismsnntx.com/
    cialis priapismo
    buy cialis online
    cialis us pharmacy online
    cialis generic

Leave a Reply

Your email address will not be published. Required fields are marked *