我試圖讓具有服務器名稱的文件要讀取由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