c# - ConfigurationManager.AppSettings or only AppSettings? -


मुझे सवाल है: जब मैं & lt;% = ConfigManager.AppSettings ["xxx"]% & gt; और & lt;% $ AppSettings: xxx% & gt;

कभी-कभी जब मैं & lt;% = ConfigManager.AppSettings ["xxx"]% का उपयोग करता हूं & Gt; और मुझे निम्न त्रुटि मिली: "सर्वर टैग में & lt;% â ?? |% & gt; निर्मित हो सकता है"।

इस उदाहरण की तरह: त्रुटि:

  & lt; एएसपी : लिफाल रनैट = "सर्वर" आईडी = "लिटरल 9" टेक्स्ट = "& lt;% = कॉन्फ़िगरेशन प्रबंधक। ऐप सेटिंग्स [" xxx "]% & gt;" & gt; & lt; / एएसपी: लीटरल & gt;   

वर्किंग:

  & asp: literal runat = "server" id = "literal9" text = '& lt;% $ app सेटिंग्स: xxx% & gt ; '& gt; & lt; / एएसपी: शाब्दिक & gt;    

त्रुटि इसलिए नहीं होती है क्योंकि आप ConfigurationManager.AppSettings < / Code> और ऐप सेटिंगिंग , लेकिन & lt;% के बाद प्रयुक्त प्रतीक के कारण। आपके पास एक सर्वर-साइड नियंत्रण के अंदर कोड रेंडरिंग मार्कअप नहीं हो सकता है जो मार्कअप रेंडर करता है। दूसरा तरीका काम करता है क्योंकि यह सर्वर-साइड नियंत्रण रेंडर से पहले अभिव्यक्ति का मूल्यांकन करता है।

मेरी वरीयता हमेशा ConfigurationManager.AppSettings का उपयोग करना है, क्योंकि यह अधिक स्पष्ट है कि कोड क्या है उपयोग हो रहा है।

Comments

Popular posts from this blog

android - How can I execute default sms app? -

jquery .css('text-decoration') doesn't work from parents -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -