我只想将TextBox控件的内容写入web服务器目录根目录中的文件...我如何指定它?
记住,我正在本地测试...它会一直将文件写入我的program files\visual studio\Common\IDE目录,而不是我的项目目录(当web服务器启动时,我假设根目录就是这个目录).
我的问题是否与在我的网站中指定正确的位置有关.配置?我试过了,但还是不行...
非常感谢...
protected void TestSubmit_ServerClick(object sender, EventArgs e) { StreamWriter _testData = new StreamWriter("data.txt", true); _testData.WriteLine(TextBox1.Text); // Write the file. _testData.Close(); // Close the instance of StreamWriter. _testData.Dispose(); // Dispose from memory. }