Create a text file in ASP.NET

We need the namespace, System.IO to use files.

The method, CreateText requires a string for an argument. The string is the path of file which will be created. After we have correctly written to the text file, we close the StreamWriter by invoking the Close method of StreamWriter. See below for example code.

<!DOCTYPE html>

<script runat="server">

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim TextFile As New System.IO.StreamWriter(Server.MapPath("test.txt"))
        TextFile.WriteLine("Lorem ipsum dolor sit amet, consectetur adipiscing elit.")
        TextFile.Close()
    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 — 5:00 pm

Comments

Add a Comment
  1. Your comment is awaiting moderation.

    Amazing lots of wonderful information!
    https://www.viagrawithoutdoctorntx.com/
    viagra sealis
    viagra pills
    name for viagra
    viagra for women

  2. Your comment is awaiting moderation.

    Truly all kinds of excellent knowledge!
    https://www.genericviagracubarx.com/
    viagra 50mg tablet cost cvs
    cheap viagra
    international launguage viagra
    generic viagra

  3. Your comment is awaiting moderation.

    Kudos! I value it.
    https://www.viagrawithoutadoctorsmim.com/
    viagra and nitrates
    buy viagra
    medicare pays for viagra
    generic viagra 100mg

  4. Your comment is awaiting moderation.

    You actually stated that effectively.
    https://www.viagrawithoutdoctormsn.com/
    insurance cover viagra
    viagra generic
    order viagra cheap
    viagra generic

  5. Your comment is awaiting moderation.

    You stated this superbly!
    https://www.viagrawithoutadoctorsmim.com/
    viagra pages edinburgh boring search girl
    viagra for women
    get a coupon to try viagra
    generic viagra

  6. Your comment is awaiting moderation.

    You actually explained this really well.
    https://www.viagrawithoutdoctorbnt.com/
    what is viagra used for gt
    cheap viagra
    can a stroke patient take viagra
    viagra for women

  7. Your comment is awaiting moderation.

    Well expressed certainly! .
    https://www.viagrawithoutadoctorsmim.com/
    viagras ad campaign
    viagra pills
    online viagra experment
    viagra without a doctor prescription

  8. Your comment is awaiting moderation.

    You’ve made the point!
    https://www.viagrawithoutdoctormsn.com/
    trial prescriptions of viagra
    generic viagra 100mg
    buy viagra cheapest
    generic viagra online

  9. Your comment is awaiting moderation.

    You said it very well..
    https://www.viagrawithoutdoctorbnt.com/
    free viagra samples
    viagra pills
    generic viagra contains sildenafil citrate
    buy viagra

  10. Your comment is awaiting moderation.

    Very good material. With thanks.
    https://www.viagrawithoutadoctorsmim.com/
    does female viagra really work
    generic viagra
    what happens is women take viagra
    viagra generic

  11. Your comment is awaiting moderation.

    Cheers, Ample material.

    https://www.viagrawithoutdoctorbnt.com/
    can females take viagra
    viagra for sale uk
    find viagra free sites news computer
    viagra 100mg

  12. Your comment is awaiting moderation.

    Seriously lots of excellent info.
    https://www.viagrawithoutadoctorsmim.com/
    viagra starting dose
    generic viagra 100mg
    online viagra drugs trial packs
    generic viagra 100mg

  13. Your comment is awaiting moderation.

    Thanks a lot, Loads of posts!

    https://www.viagrawithoutdoctorbnt.com/
    chinese viagra
    buy generic viagra
    how long do viagra last
    generic viagra 100mg

  14. Your comment is awaiting moderation.

    Wonderful content. Regards!
    https://www.viagrawithoutdoctorntx.com/
    viagra dose
    buy viagra online
    dutasteride viagra
    viagra online

  15. Your comment is awaiting moderation.

    You made your position extremely nicely..
    https://www.viagrawithoutdoctorntx.com/
    viagra
    viagra without a doctors prescription
    alternative for viagra
    viagra without a doctor prescription

  16. Your comment is awaiting moderation.

    You said it superbly!
    https://www.viagrawithoutdoctorntx.com/
    horse viagra
    viagra for sale uk
    online viagra store
    generic viagra 100mg

  17. Your comment is awaiting moderation.

    Great content. Regards!
    https://www.viagrawithoutdoctorntx.com/
    phone consulation viagra
    viagra online
    postmarketing safety of sildenafil citrate viagra
    viagra for sale uk

  18. Your comment is awaiting moderation.

    Wonderful tips. Cheers!
    https://www.viagrawithoutadoctorsmim.com/
    directions for taking viagra 100mg
    generic viagra 100mg
    is revatio the same as viagra
    viagra 100mg

  19. Your comment is awaiting moderation.

    Thanks! Lots of write ups.

    https://www.viagrawithoutdoctorntx.com/
    viagra for women testostrone
    viagra pills
    viagra miller drug
    generic viagra online

  20. Your comment is awaiting moderation.

    Seriously quite a lot of fantastic information!
    https://www.viagrawithoutdoctormsn.com/
    herbal substitue for viagra
    viagra online
    generic viagra in san jose
    buy viagra

  21. Your comment is awaiting moderation.

    Thank you! A lot of content.

    https://www.viagrawithoutdoctorntx.com/
    viagra worldcanada
    viagra pills
    viagra levitra increase pleasure
    viagra for women

  22. Your comment is awaiting moderation.

    Many thanks! Good information!
    https://www.viagrawithoutdoctorbnt.com/
    viagra free sites computer
    generic viagra 100mg
    liquid viagra
    buy viagra

  23. Your comment is awaiting moderation.

    Helpful information. Cheers.
    https://www.viagrawithoutadoctorsmim.com/
    viagra for delayed ejaculation
    viagra generic
    find viagra edinburgh pages search
    buy viagra online

  24. Your comment is awaiting moderation.

    Thanks a lot. Numerous posts.

    https://www.viagrawithoutdoctorbnt.com/
    pharmaceutical viagra pens
    cheap viagra
    purchase viagra online no prescription
    generic viagra online

  25. Your comment is awaiting moderation.

    Thanks, I enjoy this.
    https://www.viagrawithoutdoctormsn.com/
    viagra across the counter
    viagra for women
    viagra by money order
    buy generic viagra

  26. Your comment is awaiting moderation.

    Truly quite a lot of superb tips.
    https://www.viagrawithoutdoctormsn.com/
    viagra sverige
    viagra 100mg
    viagra pulmonary htn
    buy viagra online

  27. Your comment is awaiting moderation.

    Truly a good deal of useful data.
    https://www.viagrawithoutdoctormsn.com/
    viagra discovery lawsuits of blindness
    generic viagra online
    cost of viagra at walmart pharmacy
    viagra for women

  28. Your comment is awaiting moderation.

    Thanks! Wonderful information.
    https://www.viagrawithoutdoctorbnt.com/
    viagra trials private instruction
    viagra for women
    topic 3642 viagra
    viagra without a doctors prescription

  29. Your comment is awaiting moderation.

    You made your point!
    https://www.viagrawithoutdoctorbnt.com/
    get viagra without a prescription
    viagra generic
    dj vadim viagra
    generic viagra 100mg

  30. Your comment is awaiting moderation.

    Thank you, Useful information!
    https://www.viagrawithoutdoctorbnt.com/
    pictures of patients using viagra
    viagra for women
    viagra pill cutter
    viagra without a doctors prescription

  31. Your comment is awaiting moderation.

    Great data. Thank you!
    https://www.viagrawithoutadoctorsmim.com/
    peanut butter the poor mans viagra
    viagra for women
    generic viagra soft
    generic viagra 100mg

  32. Your comment is awaiting moderation.

    Thanks a lot. I appreciate this!
    https://www.genericviagracubarx.com/
    generic name of viagra
    buy generic viagra
    identifying viagra
    cheap viagra

  33. Your comment is awaiting moderation.

    Helpful stuff. Appreciate it!
    https://www.viagrawithoutdoctorbnt.com/
    viagra side effacts
    cheap viagra
    radip release viagra tablets
    generic viagra

  34. Your comment is awaiting moderation.

    Incredible quite a lot of very good info!
    https://www.viagrawithoutdoctorntx.com/
    uses for viagra
    viagra online
    viagra vs cialas
    buy viagra online

  35. Your comment is awaiting moderation.

  36. Your comment is awaiting moderation.

    Seriously a good deal of useful tips!
    https://www.viagrawithoutdoctormsn.com/
    cheap viagra cialis levitra
    viagra online
    paroxetine viagra
    viagra 100mg

  37. Your comment is awaiting moderation.

    Nicely put, Regards.
    https://www.genericviagracubarx.com/
    viagra and erections
    viagra 100mg
    does viagra cause macular degeneration
    cheap viagra

  38. Your comment is awaiting moderation.

    You actually revealed this exceptionally well!
    https://www.viagrawithoutdoctorntx.com/
    herbal substitutes for viagra
    viagra 100mg
    viagra good morning papa mp3
    viagra pills

  39. Your comment is awaiting moderation.

    Regards! Very good information!
    https://www.viagrawithoutdoctorbnt.com/
    viagra types
    generic viagra 100mg
    stamina rx and viagra
    buy viagra online

  40. Your comment is awaiting moderation.

    Very good material. Regards!
    https://www.viagrawithoutadoctorsmim.com/
    viagra vision problems
    viagra without a doctors prescription
    generic viagra 24 hours delivery
    generic viagra 100mg

  41. Your comment is awaiting moderation.

    Very well expressed genuinely. !
    https://www.genericviagracubarx.com/
    viagra and teenren
    buy viagra online
    viagra canadian pharmacies
    viagra pills

  42. Your comment is awaiting moderation.

    Nicely put. Thank you!
    https://www.viagrawithoutdoctorbnt.com/
    viagra and blood preddure
    buy viagra online
    female viagra in las vegas
    generic viagra online

  43. Your comment is awaiting moderation.

    Nicely put. With thanks!
    https://www.viagrawithoutdoctorbnt.com/
    viagra information
    generic viagra 100mg
    kamagra kamagra kamagra lovegra uk viagra
    generic viagra

  44. Your comment is awaiting moderation.

    This is nicely expressed. .
    https://www.viagrawithoutdoctormsn.com/
    medical journals pulmonary hypertension viagra
    generic viagra online
    maid training story viagra
    viagra 100mg

  45. Your comment is awaiting moderation.

    Very well expressed truly! !
    https://www.viagrawithoutadoctorsmim.com/
    legal female viagra alike
    viagra online
    cheap viagra canadian
    cheap viagra

  46. Your comment is awaiting moderation.

    Thanks. Quite a lot of tips.

    https://www.viagrawithoutdoctorbnt.com/
    buying viagra prescription
    viagra online
    vaquerax dietary supplements viagra replacements
    viagra online

  47. Your comment is awaiting moderation.

    Really plenty of wonderful tips.
    https://www.viagrawithoutadoctorsmim.com/
    no prescription viagra
    cheap viagra
    blue vision viagra
    buy viagra

  48. Your comment is awaiting moderation.

    Truly quite a lot of amazing tips!
    https://www.viagrawithoutdoctorbnt.com/
    maid training story viagra
    viagra online
    problems with generic viagra
    generic viagra

  49. Your comment is awaiting moderation.

    Kudos! Excellent information.
    https://www.viagrawithoutdoctorntx.com/
    nu virgos viagra
    viagra 100mg
    viagra eyesight
    generic viagra

  50. Your comment is awaiting moderation.

    Good advice. Cheers.
    https://www.viagrawithoutdoctorbnt.com/
    viagra coupon
    buy generic viagra
    card com viagra
    generic viagra online

  51. Your comment is awaiting moderation.

    Regards. Lots of write ups!

    https://www.genericviagracubarx.com/
    commande viagra
    generic viagra
    viagra rubbish
    buy viagra

  52. Your comment is awaiting moderation.

    Many thanks, An abundance of knowledge!

    https://www.viagrawithoutdoctormsn.com/
    negative side affects of viagra
    viagra without a doctor prescription
    napraxen viagra
    generic viagra 100mg

  53. Your comment is awaiting moderation.

    Reliable write ups. Regards.
    https://www.viagrawithoutdoctorntx.com/
    prostrate cancer and viagra
    buy generic viagra
    edinburgh pages find sites viagra online
    generic viagra

  54. Your comment is awaiting moderation.

    Helpful advice. Thanks!
    https://www.viagrawithoutdoctormsn.com/
    viagra sperm
    viagra for sale uk
    how to take viagra sublingual
    viagra online

  55. Your comment is awaiting moderation.

    Good data. Thank you!
    https://www.viagrawithoutdoctormsn.com/
    natural foods that sub viagra affects
    generic viagra online
    viagra pill spliting
    viagra without a doctors prescription

  56. Your comment is awaiting moderation.

    Many thanks. A good amount of content.

    https://www.viagrawithoutdoctorbnt.com/
    viagra cum
    viagra pills
    no prescription viagra generic discount
    viagra for sale uk

  57. Your comment is awaiting moderation.

    Regards, Plenty of advice!

    https://www.viagrawithoutdoctorntx.com/
    viagra galloway
    generic viagra
    buy non-generic viagra online
    buy viagra

  58. Your comment is awaiting moderation.

    Thanks a lot! Awesome information!
    https://www.viagrawithoutdoctormsn.com/
    viagra and aspring together
    viagra pills
    cost of cialis vs viagra
    buy viagra online

  59. Your comment is awaiting moderation.

    Beneficial facts. With thanks!
    https://www.genericviagracubarx.com/
    natural viagra for women
    cheap viagra
    viagra blogs
    viagra without a doctors prescription

  60. Your comment is awaiting moderation.

    Nicely put, Thanks.
    https://www.viagrawithoutdoctormsn.com/
    cilias viagra europe
    viagra without a doctors prescription
    generic viagra buy sildenafil citrate
    generic viagra 100mg

  61. Your comment is awaiting moderation.

    Wonderful information. Appreciate it!
    https://www.viagrawithoutdoctorntx.com/
    can nitroglycerin be used like viagra
    cheap viagra
    viagra without a prescription legal
    viagra online

  62. Your comment is awaiting moderation.

    You actually expressed it fantastically!
    https://www.viagrawithoutadoctorsmim.com/
    take alternative viagra and take nitrates
    viagra online
    kamagra or viagra
    buy viagra

  63. Your comment is awaiting moderation.

    Thanks. Ample write ups!

    https://www.genericviagracubarx.com/
    myocarditis viagra
    generic viagra
    taladafil versus viagra
    buy viagra

  64. Your comment is awaiting moderation.

    Whoa loads of great information.
    http://viagrawithoutadoctorsntx.com/
    about viagra
    viagra 100mg
    buy viagra ventricular a href
    generic viagra 100mg

  65. Your comment is awaiting moderation.

    Fantastic stuff, Many thanks.
    http://viagrawithoutadoctorsntx.com/
    herbal alternative viagra levitra herb
    viagra without a doctor prescription
    generic viagra for sale
    viagra for women

  66. Your comment is awaiting moderation.

    With thanks, Wonderful information.
    http://viagrapego.com/
    help buying viagra
    cheap viagra
    viagra clitoris
    generic viagra 100mg

  67. Your comment is awaiting moderation.

    This is nicely expressed! !
    http://viagrawithoutadoctorsntx.com/
    viagra cialis on line
    viagra for women
    same drug as viagra herbal
    viagra 100mg

  68. Your comment is awaiting moderation.

    You actually mentioned that adequately!
    http://viagrawithoutadoctormsn.com/
    who can use viagra
    generic viagra 100mg
    natural over the counter cialas viagra
    buy viagra

  69. Your comment is awaiting moderation.

    Amazing tons of great information.
    http://viagrawithoutadoctormsn.com/
    natural herbal substitute for viagra
    viagra online
    medicare pays for viagra
    buy viagra online

  70. Your comment is awaiting moderation.

    Beneficial forum posts. Many thanks!
    http://viagrawithoutadoctorsntx.com/
    reduce headache when taking viagra
    viagra generic
    walmart generic viagra
    buy viagra online

  71. Your comment is awaiting moderation.

    Kudos! Numerous write ups!

    http://viagrapego.com/
    streets of rage viagra
    generic viagra 100mg
    buy viagra online in canada
    viagra without a doctor prescription

  72. Your comment is awaiting moderation.

    You actually mentioned this fantastically!
    http://viagrapego.com/
    viagra testosterone
    generic viagra 100mg
    interaction of levitra and viagra
    viagra without a doctor prescription

Leave a Reply

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