这是Xml文件(这个文件我用TXt和Xml两种都试了都是一样的结果)
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<ConnectionString>Data Source=yf; user id=ctm_dbo;password=123</ConnectionString>
</appSettings>
</configuration>
----------------------------------------------
<configuration>
<appSettings>
<ConnectionString>Data Source=yf; user id=ctm_dbo;password=123</ConnectionString>
</appSettings>
</configuration>
----------------------------------------------
代码
string strXml = File.ReadAllText(Server.MapPath("~\\Xml\\Messages.txt")).ToString();
ClientScriptManager csm = this.ClientScript;
csm.RegisterStartupScript(this.GetType(), "sufei",strXml);
ClientScriptManager csm = this.ClientScript;
csm.RegisterStartupScript(this.GetType(), "sufei",strXml);
------------------------------------
输出的结果是
Data Source=yf; user id=ctm_dbo;password=123
但是大家打开html的源代码看一下就明白了,快捷键是Alt+V+C
但是大家打开html的源代码看一下就明白了,快捷键是Alt+V+C
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<ConnectionString>Data Source=yf; user id=ctm_dbo;password=123</ConnectionString>
</appSettings>
</configuration>
<configuration>
<appSettings>
<ConnectionString>Data Source=yf; user id=ctm_dbo;password=123</ConnectionString>
</appSettings>
</configuration>