E' in basic, ma la sostanza non muta.
codice:
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Const nome_file As String = "c:\tmp\prova.txt"
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
If Not Me.IsPostBack Then
leggiFile()
End If
End Sub
Protected Sub LinkButton_salva_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton_salva.Click
If File.Exists(nome_file) Then
File.WriteAllText(nome_file, Me.TextBox1.Text)
Else
File.AppendAllText(nome_file, Me.TextBox1.Text)
End If
leggiFile()
End Sub
Protected Sub leggiFile()
If File.Exists(nome_file) Then
Me.TextBox1.Text = File.ReadAllText(nome_file)
End If
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function pageLoad()
{
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" Height="280px" Width="422px"></asp:TextBox>
<asp:LinkButton ID="LinkButton_salva" runat="server">Salva</asp:LinkButton>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" DynamicLayout="False">
<ProgressTemplate>
[img]../immagini/indicator.white.gif[/img]<span>Aggiornamento in corso, prego attendere...</span>
</ProgressTemplate>
</asp:UpdateProgress>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>