Using IsolatedStorageFileStream : IsolatedStorageFileStream « File Directory « ASP.Net






Using IsolatedStorageFileStream

<%@ Page %>
<script language="C#" runat="server">
void Page_Load(Object sender, EventArgs e)
{
  System.IO.IsolatedStorage.IsolatedStorageFileStream stream = null;
  System.IO.StreamWriter writer = null;
  String data = "The data you want to store";

  try
  {
    stream = new System.IO.IsolatedStorage.IsolatedStorageFileStream("Data.txt", System.IO.FileMode.OpenOrCreate);
    writer = new System.IO.StreamWriter(stream);

    writer.WriteLine(data);
  }
  catch (Exception ex)
  {
    Response.Write(ex.ToString());
  }
  finally
  {
    writer.Close();
    stream.Close();
  }
}
</script>

 








Related examples in the same category

1.StreamWriter from IsolatedStorageFileStream