I can't get this asp.net page do write to a file. I was following this guide. I am not sure what i am doing wrong because i can use this button to change label text, but not to print "Hello World" into a text file in the same directory.
<%@ Page Language="C#" %>
<script runat="server">
void Button1_Click(Object sender, EventArgs e)
{
using (StreamWriter w = new StreamWriter(Server.MapPath("~/Saved Layouts.txt"), true))
{
w.WriteLine("Hello World"); // Write the text
}
}
</script>
<html>
<head>
<title>Single-File Page Model</title>
</head>
<body>
<form runat="server">
<div>
<asp:Label id="Label1"
runat="server" Text="Label">
</asp:Label>
<br />
<asp:Button id="Button1"
runat="server"
onclick="Button1_Click"
Text="Button">
</asp:Button>
</div>
</form>
</body>
</html>