ASP.Net/Response/URI URL
Содержание
Creating Absolute URLs for cookieless sessions (VB.net)
<source lang="csharp">
<%@ 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>
</source>
Displaying URL information: Host (VB.net)
<source lang="csharp">
<%@ Page Language="vb" %> <html>
<head> <title>Displaying URL information in ASP.NET</title> </head>
<body>
<%
Dim myUri As Uri
myUri = Request.Url
Response.Write("Current request URL info ?
")
Response.Write("Protocol: " & myUri.Scheme & "
")
Response.Write("Port: " & myUri.Port & "
")
Response.Write("Host Name: " & myUri.Host & "
")
myUri = Request.UrlReferrer
If Not (myUri Is Nothing) Then
Response.Write("Referral URL info ?
")
Response.Write("Protocol: " & myUri.Scheme & "
")
Response.Write("Port: " & myUri.Port & "
")
Response.Write("Host Name: " & myUri.Host & "
")
Response.Write("App Path: " & myUri.AbsolutePath & "
")
Else
Response.Write("No referral URL info available.")
End If
%>
</body> </html>
</source>
Displaying URL information: Port (VB.net)
<source lang="csharp">
<%@ Page Language="vb" %> <html>
<head> <title>Displaying URL information in ASP.NET</title> </head>
<body>
<%
Dim myUri As Uri
myUri = Request.Url
Response.Write("Current request URL info ?
")
Response.Write("Protocol: " & myUri.Scheme & "
")
Response.Write("Port: " & myUri.Port & "
")
Response.Write("Host Name: " & myUri.Host & "
")
myUri = Request.UrlReferrer
If Not (myUri Is Nothing) Then
Response.Write("Referral URL info ?
")
Response.Write("Protocol: " & myUri.Scheme & "
")
Response.Write("Port: " & myUri.Port & "
")
Response.Write("Host Name: " & myUri.Host & "
")
Response.Write("App Path: " & myUri.AbsolutePath & "
")
Else
Response.Write("No referral URL info available.")
End If
%>
</body> </html>
</source>
Displaying URL information: Scheme (VB.net)
<source lang="csharp">
<%@ Page Language="vb" %> <html>
<head> <title>Displaying URL information in ASP.NET</title> </head>
<body>
<%
Dim myUri As Uri
myUri = Request.Url
Response.Write("Current request URL info ?
")
Response.Write("Protocol: " & myUri.Scheme & "
")
Response.Write("Port: " & myUri.Port & "
")
Response.Write("Host Name: " & myUri.Host & "
")
myUri = Request.UrlReferrer
If Not (myUri Is Nothing) Then
Response.Write("Referral URL info ?
")
Response.Write("Protocol: " & myUri.Scheme & "
")
Response.Write("Port: " & myUri.Port & "
")
Response.Write("Host Name: " & myUri.Host & "
")
Response.Write("App Path: " & myUri.AbsolutePath & "
")
Else
Response.Write("No referral URL info available.")
End If
%>
</body> </html>
</source>
Referral URL info (VB.net)
<source lang="csharp">
<%@ Page Language="vb" %> <html>
<head> <title>Displaying URL information in ASP.NET</title> </head>
<body>
<%
Dim myUri As Uri
myUri = Request.Url
Response.Write("Current request URL info ?
")
Response.Write("Protocol: " & myUri.Scheme & "
")
Response.Write("Port: " & myUri.Port & "
")
Response.Write("Host Name: " & myUri.Host & "
")
myUri = Request.UrlReferrer
If Not (myUri Is Nothing) Then
Response.Write("Referral URL info ?
")
Response.Write("Protocol: " & myUri.Scheme & "
")
Response.Write("Port: " & myUri.Port & "
")
Response.Write("Host Name: " & myUri.Host & "
")
Response.Write("App Path: " & myUri.AbsolutePath & "
")
Else
Response.Write("No referral URL info available.")
End If
%>
</body> </html>
</source>