ASP.Net/Response/URI URL — различия между версиями

Материал из .Net Framework эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Версия 15:30, 26 мая 2010

Creating Absolute URLs for cookieless sessions (VB.net)

<%@ Page Language="vb" %>
<html>
   <head>
      <title>Creating Absolute URLs for cookieless sessions in ASP.NET</title>
      <script runat="server">
         Sub Page_Load()
            Dim NewPath As String
            NewPath = Request.Url.Scheme & "://" & Request.Url.Host & _
               Response.ApplyAppPathModifier(Request.Url.AbsolutePath)
            Message.Text = "Modified Absolute URL = " & NewPath
         End Sub
      </script>
   </head>
<body>
   <asp:label id="Message" runat="server"/>
</body>
</html>



Displaying URL information: Host (VB.net)

<%@ Page Language="vb" %>
<html>
   <head>
      <title>Displaying URL information in ASP.NET</title>
   </head>
<body>
<p>
<%
Dim myUri As Uri
myUri = Request.Url
Response.Write("Current request URL info ?<br><br>")
Response.Write("Protocol: " & myUri.Scheme & "<br>")
Response.Write("Port: " & myUri.Port & "<br>")
Response.Write("Host Name: " & myUri.Host & "<br>")
myUri = Request.UrlReferrer
If Not (myUri Is Nothing) Then
   Response.Write("Referral URL info ?<br><br>")
   Response.Write("Protocol: " & myUri.Scheme & "<br>")
   Response.Write("Port: " & myUri.Port & "<br>")
   Response.Write("Host Name: " & myUri.Host & "<br>")
   Response.Write("App Path: " & myUri.AbsolutePath & "<br>")
Else
   Response.Write("No referral URL info available.")
End If
%>

</p>
</body>
</html>



Displaying URL information: Port (VB.net)

<%@ Page Language="vb" %>
<html>
   <head>
      <title>Displaying URL information in ASP.NET</title>
   </head>
<body>
<p>
<%
Dim myUri As Uri
myUri = Request.Url
Response.Write("Current request URL info ?<br><br>")
Response.Write("Protocol: " & myUri.Scheme & "<br>")
Response.Write("Port: " & myUri.Port & "<br>")
Response.Write("Host Name: " & myUri.Host & "<br>")
myUri = Request.UrlReferrer
If Not (myUri Is Nothing) Then
   Response.Write("Referral URL info ?<br><br>")
   Response.Write("Protocol: " & myUri.Scheme & "<br>")
   Response.Write("Port: " & myUri.Port & "<br>")
   Response.Write("Host Name: " & myUri.Host & "<br>")
   Response.Write("App Path: " & myUri.AbsolutePath & "<br>")
Else
   Response.Write("No referral URL info available.")
End If
%>

</p>
</body>
</html>



Displaying URL information: Scheme (VB.net)

<%@ Page Language="vb" %>
<html>
   <head>
      <title>Displaying URL information in ASP.NET</title>
   </head>
<body>
<p>
<%
Dim myUri As Uri
myUri = Request.Url
Response.Write("Current request URL info ?<br><br>")
Response.Write("Protocol: " & myUri.Scheme & "<br>")
Response.Write("Port: " & myUri.Port & "<br>")
Response.Write("Host Name: " & myUri.Host & "<br>")
myUri = Request.UrlReferrer
If Not (myUri Is Nothing) Then
   Response.Write("Referral URL info ?<br><br>")
   Response.Write("Protocol: " & myUri.Scheme & "<br>")
   Response.Write("Port: " & myUri.Port & "<br>")
   Response.Write("Host Name: " & myUri.Host & "<br>")
   Response.Write("App Path: " & myUri.AbsolutePath & "<br>")
Else
   Response.Write("No referral URL info available.")
End If
%>

</p>
</body>
</html>



Referral URL info (VB.net)

<%@ Page Language="vb" %>
<html>
   <head>
      <title>Displaying URL information in ASP.NET</title>
   </head>
<body>
<p>
<%
Dim myUri As Uri
myUri = Request.Url
Response.Write("Current request URL info ?<br><br>")
Response.Write("Protocol: " & myUri.Scheme & "<br>")
Response.Write("Port: " & myUri.Port & "<br>")
Response.Write("Host Name: " & myUri.Host & "<br>")
myUri = Request.UrlReferrer
If Not (myUri Is Nothing) Then
   Response.Write("Referral URL info ?<br><br>")
   Response.Write("Protocol: " & myUri.Scheme & "<br>")
   Response.Write("Port: " & myUri.Port & "<br>")
   Response.Write("Host Name: " & myUri.Host & "<br>")
   Response.Write("App Path: " & myUri.AbsolutePath & "<br>")
Else
   Response.Write("No referral URL info available.")
End If
%>

</p>
</body>
</html>