Are you sure you're not getting this back?
Using Response.Write from the code behind (either in the page or the master page) will output the string at the top of the page (usually), before the rest of the HTML, etc, which is probably not where you're expecting to see it.
I put a literal control on a master page, before the content placeholder:
On Master: <asp:Literal id="LiteralMaster" runat="server"></asp:Literal>
And then setting it's Text property in the master page's Page_Load event to:
LiteralMaster.Text = Context.Request.ServerVariables("SCRIPT_NAME")
I also added a literal control in the content placeholder on a page that used this master page:
On page: <asp:Literal id="LiteralPage" runat="server"></asp:Literal>
And in the page's Page_Load event I had the following:
LiteralPage.Text = Context.Request.ServerVariables("SCRIPT_NAME")
Which resulted in:
On Master: /LittleTest/UsingMaster.aspx
On page: /LittleTest/UsingMaster.aspx
Modifying my page's Page_Load event to become:
LiteralPage.Text = Context.Request.ServerVariables("SCRIPT_NAME")
Response.Write("From response.write: " &
Context.Request.ServerVariables("Script_Name"))
Resulted in the following display in my browser:
From response.write: /LittleTest/UsingMaster.aspx
On Master: /LittleTest/UsingMaster.aspx
On page: /LittleTest/UsingMaster.aspx
However, the html looked more like:
From response.write:/LittleTest/UsingMaster.aspx
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<form name="aspnetForm"
method="post" action="UsingMaster.aspx" id="aspnetForm">
<div>
On Master: /LittleTest/UsingMaster.aspx
<br />
On page: /LittleTest/UsingMaster.aspx
</div>
</form>
</body>
</html>
Edit to respond to comment
You are assigning the string representation of a NameValueCollection element to the contents of your label, this is just the NAME, not the combination of the NAME and the VALUE
Try the following:
For Each s As String In Request.ServerVariables
Label1.Text += s & ": " & Request.ServerVariables(s)
Next
For more info, take a look at the MSDN docs:
HttpRequest.ServerVariables