我有我的代码张贴在表单中的JavaScript数组:ASP形式的操作文件(FileSystemObject的)
<form id="my_form" action="file:///C:/Users/John/Desktop/jquery/savetext.aspx" method="post" onsubmit="return prepare()">
<input type="text" id="file_name" name="file_name" rows="1" cols="20" />
<input type="hidden" name="seatsArray" />
<input type="submit" value="Save" />
</form>
<script type="text/javascript">
function prepare();
{
document.getElementById('seatsArray').value = seatsArray.join();
return true;
}
</script>
谁能帮我出我需要的savetext.aspx操作文件,因为我的ASP.NET的知识是最小的(我习惯于PHP,但这需要是ASP.NET)。
我想我可以在越来越近的地方一条缝:
<%@ Page Language="C#" %>
<script runat="server">
using System;
using System.IO;
class Test
{
public static void Main()
{
string path = "file:///C:/Users/John/Desktop/jquery/txtfiles/" + request.form("file_name");
if (!File.Exists(path))
{
using (StreamWriter sw = File.CreateText(path))
{
sw.WriteLine(request.form("seatsArray"));
sw.WriteLine("");
}
}
using (StreamReader sr = File.OpenText(path))
{
string s = "";
while ((s = sr.ReadLine()) != null)
{
Console.WriteLine(s);
}
}
}
}
</script>
我在正确的轨道上?
非常感谢!
所以,你想要有人为你做你的工作吗?你必须更好地问。顺便说一句,.asp不是ASP.NET。 – 2010-07-12 18:31:13
我只需要一些代码来完成这个该死的事情。否则,我将不得不花费数周时间来学习如何预先做好。哦,我没有意识到有什么不同。这是ASP.NET我需要具体。 – IceDragon 2010-07-12 18:35:38
我的意思不是粗鲁,但为什么你需要用你不熟练的语言来做某些事情,而不学习语言? – 2010-07-13 14:33:30