我無法通過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