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.

    You actually stated it wonderfully!
    https://www.genericviagracubarx.com/
    viagra use in woman
    cheap viagra
    pages search viagra charles 250k
    generic viagra 100mg

  2. Your comment is awaiting moderation.

    You mentioned this exceptionally well.
    https://www.viagrawithoutadoctorsmim.com/
    10-minute viagra
    viagra without a doctor prescription
    can a psyciatrist prescribe viagra
    viagra pills

  3. Your comment is awaiting moderation.

    Nicely put. Thanks a lot.
    https://www.viagrawithoutdoctorntx.com/
    behavioral side effects of viagra
    buy viagra
    viagra ripoffs
    generic viagra

  4. Your comment is awaiting moderation.

    You actually expressed that effectively.
    https://www.viagrawithoutdoctorbnt.com/
    levitra v viagra
    viagra for sale uk
    comparison levitra viagra cialis
    viagra for women

  5. Your comment is awaiting moderation.

    Wonderful write ups, Many thanks!
    https://www.viagrawithoutadoctorsmim.com/
    wal mart pharmacy viagra price
    generic viagra
    buy viagra generic
    buy viagra online

  6. Your comment is awaiting moderation.

    You expressed that very well!
    https://www.viagrawithoutadoctorsmim.com/
    search viagra edinburgh find pages
    viagra without a doctor prescription
    oysters being spiked with viagra
    viagra for sale uk

  7. Your comment is awaiting moderation.

    You revealed it superbly!
    https://www.genericviagracubarx.com/
    find search viagra free pages computer
    viagra for sale uk
    viagra order cheap
    generic viagra 100mg

  8. Your comment is awaiting moderation.

    Effectively spoken really. .
    https://www.viagrawithoutdoctormsn.com/
    viagra’s speed
    buy viagra
    viagra in landzorote
    viagra 100mg

  9. Your comment is awaiting moderation.

    Wow tons of amazing tips.
    https://www.viagrawithoutdoctormsn.com/
    jo wang viagra bali
    buy viagra
    bull dog viagra
    viagra for women

  10. Your comment is awaiting moderation.

    Thanks, I like it.
    https://www.viagrawithoutdoctorbnt.com/
    buy viagra soft
    viagra 100mg
    vitreous detachment and viagra
    cheap viagra

  11. Your comment is awaiting moderation.

    Nicely put. Thanks!
    https://www.viagrawithoutdoctorntx.com/
    steroids and viagra dangers
    generic viagra 100mg
    mapuche viagra
    viagra for sale uk

  12. Your comment is awaiting moderation.

    This is nicely said. !
    https://www.viagrawithoutdoctormsn.com/
    ingredients to viagra
    viagra for sale uk
    viagra and lisinopril interaction
    generic viagra 100mg

  13. Your comment is awaiting moderation.

    Fantastic data. Thanks a lot.
    https://www.genericviagracubarx.com/
    viagra cealis
    generic viagra 100mg
    brand viagra without prescription
    viagra generic

  14. Your comment is awaiting moderation.

    Cheers! Good stuff.
    https://www.viagrawithoutdoctorntx.com/
    arythmea viagra
    buy generic viagra
    falsificacion de viagra
    buy generic viagra

  15. Your comment is awaiting moderation.

    Kudos, Fantastic stuff!
    https://www.genericviagracubarx.com/
    buy viagra online inu
    generic viagra 100mg
    viagra k find search edinburgh pages
    viagra without a doctors prescription

  16. Your comment is awaiting moderation.

    Cheers, Quite a lot of information.

    https://www.viagrawithoutdoctorntx.com/
    viagra sudden blindness
    cheap viagra
    viagra free sites computer news
    generic viagra 100mg

  17. Your comment is awaiting moderation.

    Nicely put. Kudos.
    https://www.viagrawithoutadoctorsmim.com/
    taking viagra and pumping my penis
    viagra for sale uk
    chinese viagra buy
    generic viagra 100mg

  18. Your comment is awaiting moderation.

    With thanks! An abundance of forum posts!

    https://www.viagrawithoutdoctormsn.com/
    limbaugh rush dominican republic viagra
    viagra online
    why india viagra laws patent
    viagra pills

  19. Your comment is awaiting moderation.

    Great forum posts. Regards.
    https://www.genericviagracubarx.com/
    viagra can cause loss of hearing
    cheap viagra
    viagra in china 2010
    generic viagra 100mg

  20. Your comment is awaiting moderation.

    Nicely put. Thanks a lot!
    https://www.viagrawithoutadoctorsmim.com/
    viagra manufacturer
    viagra without a doctor prescription
    whats best viagra cialis
    cheap viagra

  21. Your comment is awaiting moderation.

    Incredible a good deal of helpful data!
    https://www.viagrawithoutdoctormsn.com/
    herbal viagra substitute
    buy viagra
    gay viagra stories
    buy viagra

  22. Your comment is awaiting moderation.

    Appreciate it, A lot of info!

    https://www.viagrawithoutdoctormsn.com/
    viagra anally in a enema
    viagra for sale uk
    patient responses to viagra
    viagra for women

  23. Your comment is awaiting moderation.

    Cheers! A good amount of posts.

    https://www.viagrawithoutdoctorntx.com/
    cialis comparison viagra levitra
    viagra for women
    gag viagra prescription
    generic viagra online

  24. Your comment is awaiting moderation.

    Amazing information. Appreciate it.
    https://www.viagrawithoutdoctormsn.com/
    viagra 0r cialis
    generic viagra 100mg
    viagra with or without food
    generic viagra online

  25. Your comment is awaiting moderation.

    With thanks. Loads of facts.

    https://www.genericviagracubarx.com/
    viagra online quick delivery
    viagra without a doctor prescription
    viagra mail order uk
    generic viagra

  26. Your comment is awaiting moderation.

    Cheers. Lots of write ups!

    https://www.viagrawithoutdoctorntx.com/
    cnn watermelon viagra
    generic viagra 100mg
    overnight viagra generic
    buy viagra

  27. Your comment is awaiting moderation.

    Amazing forum posts. With thanks.
    https://www.viagrawithoutdoctorntx.com/
    i took too much viagra
    viagra for women
    pablo francisco viagra
    viagra for sale uk

  28. Your comment is awaiting moderation.

    Thanks a lot! Ample postings.

    https://www.viagrawithoutdoctormsn.com/
    compare viagra cialis
    viagra 100mg
    viagra nitroglycerin
    viagra pills

  29. Your comment is awaiting moderation.

    Terrific info, Thanks a lot!
    https://www.genericviagracubarx.com/
    female use of viagra
    cheap viagra
    viagra levitra cialis apcalis regalis zenegra
    viagra for sale uk

  30. Your comment is awaiting moderation.

    Thanks a lot. Loads of posts!

    https://www.viagrawithoutdoctorntx.com/
    what happens after too much viagra
    viagra generic
    india viagra
    generic viagra 100mg

  31. Your comment is awaiting moderation.

    Thanks a lot. Ample facts!

    https://www.viagrawithoutdoctorntx.com/
    an effective natural alternative to viagra
    generic viagra online
    viagra and cialis expiry notice spam
    generic viagra

  32. Your comment is awaiting moderation.

    You mentioned that well!
    https://www.genericviagracubarx.com/
    viagra online canada
    cheap viagra
    viagra alternatives otc
    viagra generic

  33. Your comment is awaiting moderation.

    You mentioned this effectively!
    https://www.viagrawithoutadoctorsmim.com/
    viagra prescription image
    generic viagra online
    viagra use by women
    viagra online

  34. Your comment is awaiting moderation.

    Many thanks! I appreciate it.
    https://www.viagrawithoutadoctorsmim.com/
    viagra prostate remova
    generic viagra 100mg
    veterans administrations formulary viagra
    viagra without a doctors prescription

  35. Your comment is awaiting moderation.

    This is nicely expressed. .
    https://www.viagrawithoutdoctorbnt.com/
    cheap fioricet soma tramadol viagra
    generic viagra online
    patient assistance for viagra
    viagra generic

  36. Your comment is awaiting moderation.

    Excellent knowledge. Thank you!
    https://www.viagrawithoutdoctormsn.com/
    viagra spider
    viagra without a doctor prescription
    online viagra testosterone
    cheap viagra

  37. Your comment is awaiting moderation.

    Amazing a lot of useful facts.
    https://www.viagrawithoutdoctorntx.com/
    cheapest viagra reviews
    buy viagra
    taking old viagra
    viagra pills

  38. Your comment is awaiting moderation.

    You’ve made your point quite nicely.!
    https://www.viagrawithoutdoctorntx.com/
    viagra dildo
    viagra without a doctors prescription
    eyesight viagra
    viagra 100mg

  39. Your comment is awaiting moderation.

    Really a lot of wonderful data!
    https://www.genericviagracubarx.com/
    best use of viagra
    generic viagra online
    viagra online sale canada
    viagra for sale uk

  40. Your comment is awaiting moderation.

    You actually said that adequately!
    https://www.viagrawithoutdoctorntx.com/
    compare levitra viagra
    viagra pills
    viagra viagra edinburgh pages search generic
    generic viagra 100mg

  41. Your comment is awaiting moderation.

    Perfectly voiced truly! !
    https://www.viagrawithoutdoctorntx.com/
    mixing vicodin viagra
    generic viagra
    viagra title object
    viagra 100mg

  42. Your comment is awaiting moderation.

    Nicely put, Kudos!
    https://www.genericviagracubarx.com/
    female viagra facts
    generic viagra 100mg
    spam email containing viagra url
    generic viagra online

  43. Your comment is awaiting moderation.

    Thank you. Fantastic information.
    https://www.viagrawithoutdoctorbnt.com/
    watermelon as viagra
    buy viagra online
    buy viagra from india
    generic viagra online

  44. Your comment is awaiting moderation.

    You actually reported it wonderfully.
    https://www.genericviagracubarx.com/
    vision problems while using viagra
    viagra without a doctor prescription
    viagra cialis walmart
    viagra without a doctors prescription

  45. Your comment is awaiting moderation.

    With thanks. Lots of write ups.

    https://www.viagrawithoutadoctorsmim.com/
    viagra online in uk
    viagra without a doctor prescription
    does viagra affect chances of pregnany
    buy viagra online

  46. Your comment is awaiting moderation.

    Superb information, Appreciate it!
    https://www.viagrawithoutdoctorntx.com/
    dad viagra
    viagra without a doctor prescription
    viagra internet scam poland
    viagra for sale uk

  47. Your comment is awaiting moderation.

    Amazing tons of terrific material.
    https://www.viagrawithoutadoctorsmim.com/
    viagra research article
    generic viagra 100mg
    using less viagra
    viagra generic

  48. Your comment is awaiting moderation.

    Incredible tons of awesome material.
    https://www.viagrawithoutdoctormsn.com/
    interactions of different medications with viagra
    buy viagra
    viagra adverse reactions
    buy generic viagra

  49. Your comment is awaiting moderation.

    You said it nicely..
    https://www.viagrawithoutdoctorbnt.com/
    smell sensitivity with viagra
    cheap viagra
    wat does viagra do
    viagra without a doctor prescription

  50. Your comment is awaiting moderation.

    You have made your position extremely clearly.!
    https://www.viagrawithoutdoctormsn.com/
    buy citrate com generic sildenafil viagra
    viagra 100mg
    forum viagra
    viagra 100mg

  51. Your comment is awaiting moderation.

    Perfectly voiced really. .
    https://www.viagrawithoutdoctorntx.com/
    bob dole viagra commercial
    generic viagra 100mg
    epinephrine viagra contradiction
    viagra pills

  52. Your comment is awaiting moderation.

    Thanks! Lots of posts.

    https://www.viagrawithoutdoctormsn.com/
    comparison levitra viagra cialis
    viagra for sale uk
    drugs like viagra
    viagra for sale uk

  53. Your comment is awaiting moderation.

    Incredible loads of good material!
    https://www.viagrawithoutdoctorbnt.com/
    who benefits from viagra
    generic viagra 100mg
    viagra headquarters in canada
    viagra pills

  54. Your comment is awaiting moderation.

    Regards, I enjoy this.
    https://www.viagrawithoutadoctorsmim.com/
    finasteride viagra
    viagra for women
    edinburgh uk viagra cfm moo tid
    viagra generic

  55. Your comment is awaiting moderation.

    Nicely put, Regards!
    https://www.viagrawithoutdoctormsn.com/
    celery viagra
    viagra pills
    viagra funny video
    viagra online

  56. Your comment is awaiting moderation.

    Cheers. I value it.
    https://www.viagrawithoutdoctorbnt.com/
    vitreous detachment and viagra
    generic viagra 100mg
    relative strength of viagra levitra ciallis
    buy viagra

  57. Your comment is awaiting moderation.

    Thanks! Fantastic stuff.
    https://www.genericviagracubarx.com/
    stores that sell viagra in australia
    viagra without a doctors prescription
    viagra coma
    generic viagra

  58. Your comment is awaiting moderation.

  59. Your comment is awaiting moderation.

    Valuable knowledge. Regards!
    https://www.viagrawithoutdoctorntx.com/
    20 minute viagra pill under
    viagra 100mg
    erections on viagra
    generic viagra 100mg

  60. Your comment is awaiting moderation.

    Cheers, I value it!
    https://www.viagrawithoutadoctorsmim.com/
    kids on viagra
    viagra 100mg
    pharmacy viagra fuerteventura
    viagra for sale uk

  61. Your comment is awaiting moderation.

    Fine advice. Many thanks!
    https://www.viagrawithoutdoctorntx.com/
    foods act like viagra
    cheap viagra
    what dosage of viagra
    viagra for women

  62. Your comment is awaiting moderation.

    Fantastic data. Thanks.
    http://viagrawithoutadoctorsntx.com/
    generic viagra online reviews
    viagra pills
    wholesalers of viagra
    viagra generic

  63. Your comment is awaiting moderation.

    Thanks, An abundance of posts!

    http://viagrapego.com/
    what does viagra do to women
    viagra generic
    get viagra prescription online
    generic viagra online

  64. Your comment is awaiting moderation.

    Wonderful knowledge. Cheers.
    http://viagrawithoutadoctorsntx.com/
    viagra non perscription deal sale
    viagra pills
    whats next when viagra dont work
    viagra for sale uk

  65. Your comment is awaiting moderation.

    Very good content. Regards.
    http://viagrawithoutadoctormsn.com/
    wife sold ski doo viagra
    viagra for women
    vicoden morphine viagra
    generic viagra 100mg

  66. Your comment is awaiting moderation.

    Fine advice. Cheers.
    http://viagrawithoutadoctormsn.com/
    viagra cialis for ed
    buy viagra
    viagra clipart
    viagra pills

  67. Your comment is awaiting moderation.

    Seriously plenty of amazing facts.
    http://viagrawithoutadoctorsntx.com/
    nitric oxide and viagra together
    generic viagra 100mg
    viagra v-15 picture
    generic viagra 100mg

  68. Your comment is awaiting moderation.

    Nicely put, Thanks a lot!
    http://viagrawithoutadoctorsntx.com/
    generic viagra super active
    cheap viagra
    works faster viagra cialis
    generic viagra 100mg

  69. Your comment is awaiting moderation.

    Terrific facts. Appreciate it.
    http://viagrawithoutadoctormsn.com/
    soft viagra tablets
    viagra generic
    viagra miracle drug or miracle drug
    generic viagra 100mg

  70. Your comment is awaiting moderation.

    Whoa a lot of helpful info!
    http://viagrawithoutadoctorsntx.com/
    canadas viagra commercial
    buy viagra online
    formula for viagra
    viagra for women

Leave a Reply

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