File Directory ASP.Net Tutorial

<%@ Page Language="vb" Explicit="true" Strict="true" %>
<%@ Import Namespace = "System.IO" %>

    Sub CreateFile(sender As Object, e As EventArgs)
        If Trim(TextContent.Text).Length > 0 Then
            Dim myFileStream As StreamWriter = Nothing
            Try
                myFileStream = File.CreateText(Server.MapPath(".\Upload\") & "test.txt")
                myFileStream.WriteLine(TextContent.Text)
                myFileStream.Close()
                Output.Text = "File Successfully Created!"
            Catch exc As Exception
                Output.Text = "Error in Creating file. Error is " & exc.ToString()
            Finally
        If Not myFileStream Is Nothing Then
          myFileStream.Close()
        End If
            End Try
        Else
            Output.Text = "File not created, because you didn't enter anything!"
        End If
    End Sub


  
    Creating a File