日期:2014-05-18  浏览次数:20387 次

{100分},急,加急的,求如何获取“自定义设置节”的值,在线,好了给分。加急的。
是Web.Config中的

<?xml   version= "1.0 "   encoding= "utf-8 "?>

<configuration>
    <configSections>
        <sectionGroup   name= "F1 ">
            <section   name= "F2 "   type= "Student.Test,Student "/>
        </sectionGroup>
    </configSections>
    <F1>
        <F2>
            <F3   name= "Email "   TextType= "A++ "   Info= "Important "   message= "{0}   非常重要的 "/>
            <F3   name= "Email1 "   TextType= "A "   Info= "level1 "   message= "{0}一般! "/>
        <F3   name= "Email2 "   TextType= "A+ "   Info= "level2 "   message= "{0}平常{1}! "/>
                    </F2>
    </F1>
        <appSettings/>
        <connectionStrings/>
   
        <system.web>
         
                <compilation   debug= "true "   />
           

                <customErrors   mode= "RemoteOnly "   defaultRedirect= "GenericErrorPage.htm ">
                        <error   statusCode= "403 "   redirect= "NoAccess.htm "   />
                        <error   statusCode= "404 "   redirect= "FileNotFound.htm "   />
                </customErrors>
                -->
        </system.web>
</configuration>


我想取得自定义配置节F2组中,F3   的Email2   的TextType,Info,message的数据如何作呢?我急用,请高人,能人照顾一下。好了立即,奉上。


------解决方案--------------------
建议你定义成如下格式:
<appSettings>
<add key= "Email " value= "Email "/>
<add key= "TextType " value= "A++ "/>
<add key= "Info " value= "Important "/>
<add key= "message " value= "非常重要的 "/>
</appSettings>
这样就可以轻松的读取了。

------解决方案--------------------
http://blog.csdn.net/yes555/archive/2006/05/06/710451.aspx
------解决方案--------------------
bigmingming(明明兄)


你说的是,1.1中用的方法,在2.0中已经不支持了,
在2.0中,只支持

System.Configuration.ConfigurationManager.GetSection( "*** ");
------解决方案--------------------
public static bool appSettingsEdit(string WebConfigDirectory, string appSettingsAddkey, string keyvalue)