我无法通过web.config进行读取。我的web.config是如下从javascript中读取web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<configSections>
<section name="datalayers" type="Basic" />
</configSections>
<maplayers>
<openlayers projection="EPSG:900913" displayProjection="EPSG:27700"/>
</maplayers>
</configuration>
要读我做了以下
var conn = '<%=ConfigurationManager.maplayers.displayprojection %>'
alert(conn);
我的页面有什么明显错误不会加载。请帮忙。在ASP.NET
[ConfigurationProperty("displayprojection", IsRequired = false)]
public string DisplayProjection
{
get { return (string)this[ "displayprojection" ]; }
set { this[ "displayprojection" ] = value; }
}
阅读财产试图写JSON在ASP.NET
JsonSerializer serializer = new JsonSerializer();
if (DisplayProjection != string.Empty)
{
writer.WritePropertyName("displayProjection");
writer.WriteValue(DisplayProjection);
}
writer.WriteEnd();
定义“不加载”。你有错误吗?你有没有得到一个HTTP状态码? – Quentin
控制台为错误写入的内容是什么?有没有试图把'.ToString()'放在后面? – 2013-12-18 15:47:24
我试图把ToString(),但我的页面不加载。没有http错误,但页面只是挂起。通过ASP.NET获取web.cofig值到javascript的正确方法是什么? – user2837961