|
|
|
|
Iterating Through ServerVariables in ASP.Net and C#
By TamilCodes
Added on May 10, 2009
Viewed 7408 Times
Sometimes you may need to verify all the servervariables to debug your code. Simply iterating through the servervariables collection can bring out the result. The following snippet is suffice to iterate.
CodeBehind:
protected void Page_Load(object sender, EventArgs e)
{
foreach (string x in Request.ServerVariables)
{
Label1.Text += x.ToString() + " : ";
Label1.Text += Request.ServerVariables[x].ToString() + "<br/>";
}
}
.aspx file
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
</div>
</form>
Comments
No Comments. Be the first to post comments
|
|