我想從訪問配置文件來自另一臺計算機的例子。C#如何通過網絡從另一臺PC訪問配置文件
string location = @"\\SERVER\Shared\Ramgy\Settings.config"
// get server from **SERVER** location
this.txthostname.Text = Properties.Settings.Default.server;
// get port from the SERVER location
this.txtport.Text = Properties.Settings.Default.port;
//get username from the SERVER location
this.txtusername.Text = Properties.Settings.Default.username;
// get password from the SERVER location
this.txtpassword.Text = Properties.Settings.Default.password;
// get database from the SERVER location
this.txtdatabase.Text = Properties.Settings.Default.database;
你必須使用UNC網絡路徑讀它。 –
@JeremyThompson你可以給我們一些UNC網絡的例子。 –
@JeremyThompson我得到了我的問題的答案,我用'string server = doc.DocumentElement.SelectSingleNode(「Hostname」)。InnerText;'來獲得服務器。 –