How can I get a list of all the environment variables

Platform: ASP.NET| Category: DataList

VB.NET


<asp:DataList id='DataList1' runat='server'>
	<HeaderTemplate>
	<table>
	</HeaderTemplate>
	<ItemTemplate>
	<tr>
	<td>
		<%# CType(Container.DataItem, DictionaryEntry).Key  %>
	</td>
	<td>
		<%# CType(Container.DataItem, DictionaryEntry).Value%>
	</td>
	</tr>
	</ItemTemplate>
	<FooterTemplate>
	</table>
	</FooterTemplate>
</asp:DataList>

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        	’Put user code to initialize the page here
        	DataList1.DataSource = System.Environment.GetEnvironmentVariables()
        	DataList1.DataBind()
End Sub

C#


<asp:DataList id='DataList1' runat='server'>
	<HeaderTemplate>
	<table>
	</HeaderTemplate>
	<ItemTemplate>
	<tr>
	<td>
		<%# ((DictionaryEntry)Container.DataItem).Key %>
	</td>
	<td>
		<%# ((DictionaryEntry)Container.DataItem).Value %>
	</td>
	</tr>
	</ItemTemplate>
	<FooterTemplate>
	</table>
	</FooterTemplate>
</asp:DataList>

private void Page_Load(object sender, System.EventArgs e)
{
	// Put user code to initialize the page here
	DataList1.DataSource = System.Environment.GetEnvironmentVariables();
	DataList1.DataBind();
}

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.