ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Read contents from AppSetting using Split function in ASP.Net using C# and VB.Net<p>You can access by its index value like below.</p> <p><strong>HTML</strong></p> <pre class="brush: html">&lt;asp:Label ID=&#34;lblValue1&#34; runat=&#34;server&#34;&gt;&lt;/asp:Label&gt; &lt;asp:Label ID=&#34;lblValue2&#34; runat=&#34;server&#34;&gt;&lt;/asp:Label&gt; &lt;asp:Label ID=&#34;lblValue3&#34; runat=&#34;server&#34;&gt;&lt;/asp:Label&gt; &lt;asp:Label ID=&#34;lblValue4&#34; runat=&#34;server&#34;&gt;&lt;/asp:Label&gt; &lt;asp:Label ID=&#34;lblValue5&#34; runat=&#34;server&#34;&gt;&lt;/asp:Label&gt;</pre> <p><strong>C#</strong></p> <pre class="brush: csharp">string[] mykey = ConfigurationManager.AppSettings[&#34;mykey&#34;].Split(&#39;,&#39;); // By for loop for (int i = 0; i &lt; mykey.Length; i++) { switch (i) { case 0: lblValue1.Text = mykey[i].ToString(); break; case 1: lblValue2.Text = mykey[i].ToString(); break; case 2: lblValue3.Text = mykey[i].ToString(); break; case 3: lblValue4.Text = mykey[i].ToString(); break; case 4: lblValue5.Text = mykey[i].ToString(); break; } } // By setting index lblValue1.Text = mykey[0].ToString(); lblValue2.Text = mykey[1].ToString(); lblValue2.Text = mykey[2].ToString(); lblValue4.Text = mykey[3].ToString(); lblValue5.Text = mykey[4].ToString();</pre> <p><strong>&nbsp;VB.Net</strong> </p> <pre class="brush: vb">Dim mykey As String() = ConfigurationManager.AppSettings(&#34;mykey&#34;).Split(&#34;,&#34;c) For i As Integer = 0 To mykey.Length - 1 Select Case i Case 0 lblValue1.Text = mykey(i).ToString() Case 1 lblValue2.Text = mykey(i).ToString() Case 2 lblValue3.Text = mykey(i).ToString() Case 3 lblValue4.Text = mykey(i).ToString() Case 4 lblValue5.Text = mykey(i).ToString() End Select Next lblValue1.Text = mykey(0).ToString() lblValue2.Text = mykey(1).ToString() lblValue2.Text = mykey(2).ToString() lblValue4.Text = mykey(3).ToString() lblValue5.Text = mykey(4).ToString() </pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/144628/Read-contents-from-AppSetting-using-Split-function-in-ASPNet-using-C-and-VBNet/https://www.aspforums.net:443/Threads/144628/Read-contents-from-AppSetting-using-Split-function-in-ASPNet-using-C-and-VBNet/Wed, 14 Mar 2018 23:55:04 GMT