I am new to C# and ASP.Net, and I am running into this error
Compiler Error Message: CS0246: The type or namespace name 'StreamWriter' could not be found (are you missing a using directive or an assembly reference?)
Here is my code Currently:
<% @Page Language="C#" %>
<!-- code section -->
<script runat="server">
private void WriteUpper(object sender, EventArgs e)
{
string str = mytext.Value;
using (StreamWriter outputFile = new StreamWriter(@"~\AppData\data.txt", true)) {
outputFile.WriteLine(str);
}
}
</script>
<!-- Layout -->
<html>
<head>
<title> Untitled </title>
</head>
<body>
<form id="Form1" runat="server">
<input runat="server" id="mytext" type="text" />
<input runat="server" id="button1" type="submit" value="Enter..." OnServerClick="WriteUpper"/>
<hr />
</form>
</body>
</html>