Imports System.IO
Imports System.Text

Partial Class Default3
    Inherits System.Web.UI.Page

    Protected path As String = "test.html"


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            RadEditor1.Content = ReadFile(Server.MapPath(Path))
        End If
    End Sub

    Protected Function ReadFile(ByVal path As String) As String
        If Not System.IO.File.Exists(path) Then
            Return String.Empty
        End If
        Using sr As New System.IO.StreamReader(path)
            Return sr.ReadToEnd()
        End Using
    End Function

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Using externalFile As New StreamWriter(Me.MapPath(path), False, Encoding.UTF8)
            externalFile.Write(RadEditor1.Content)
        End Using
    End Sub
End Class
