我试图让具有服务器名称的文件要读取由htmnl(用C#脚本来完成阅读),但我不能拿到剧本将名字传下去到html,这是代码:在HTML C#脚本不读文件
<%@ Page Language="C#" MasterPageFile="~/MasterPage3.master" Title="Services" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<center>
<script runat="server">
string[] server = new string[] { };
void Button1_Click(Object sender, EventArgs e)
{
string[] server = System.IO.File.ReadAllLines(@"C:\server.txt"); //here i get the name of the server
return server[1];
}
</script>
<br />
<table width="600px" style="border-color: Silver; border-style: solid; border: 1">
<tr>
<td style="background-color: LightBlue; text-align: center">
<a href="Default.aspx?SERVER=1">1</a>
</td>
</tr>
<tr>
<td style="background-color: LightBlue; text-align: center">
<a href="Default.aspx?SERVER=2">2</a>
</td>
</tr>
<tr>
<td style="background-color: LightBlue; text-align: center">
<a href='Default.aspx?SERVER=' <%#server[1]%>>JD5PKF1</a>
</td>
//but i cant get it to be read here
</tr>
<input type="button" value="All in one" onclick="location.href='Option2.aspx';">
</table>
</center>
</asp:Content>
有什么想法吗?
我没有看到任何东西,甚至试图传递服务器名称。你有什么异常?你有什么方法试图把名字带入html端? – 2013-02-21 22:32:58
'
是的,我忘了添加返回,当我发布这个,基本上它返回服务器[1]; (我知道它有一些东西在里面 – Damian 2013-02-22 14:56:38