Request.ServerV ariables still works in ASP.NET like it
did in ASP.
Try this... It will list all of the server variables for
you.
Keith
[Visual Basic]
Dim loop1, loop2 As Integer
Dim arr1(), arr2() As String
Dim coll As NameValueCollec tion
' Load ServerVariable collection into NameValueCollec tion
object.
coll=Request.Se rverVariables
' Get names of all keys into a string array.
arr1 = coll.AllKeys
For loop1 = 0 To arr1.GetUpperBo und(0)
Response.Write( "Key: " & arr1(loop1) & "<br>")
arr2 = coll.GetValues( loop1) ' Get all values under
this key.
For loop2 = 0 To arr2.GetUpperBo und(0)
Response.Write( "Value " & CStr(loop2) & ": " & arr2
(loop2) & "<br>")
Next loop2
Next loop1
[C#]
int loop1, loop2;
NameValueCollec tion coll;
// Load ServerVariable collection into
NameValueCollec tion object.
coll=Request.Se rverVariables;
// Get names of all keys into a string array.
String[] arr1 = coll.AllKeys;
for (loop1 = 0; loop1 < arr1.Length; loop1++)
{
Response.Write( "Key: " + arr1[loop1] + "<br>");
String[] arr2=coll.GetVa lues(arr1[loop1]);
for (loop2 = 0; loop2 < arr2.Length; loop2++) {
Response.Write( "Value " + loop2 + ": " + arr2
[loop2] + "<br>");
}
}
-----Original Message-----
Hi All,
Is there a way to get page name in asp.net code behind?
I use this to logerror messages in DB ( and in which page the error
occured )For instance , if it is welcome.aspx , then in C# code ,
I want to get thispage name to store in DB ( There is a way with Request
object , but I wantto retrieve the name in another way )
Any help is appreciated :)
Regards
Ersin
.