Mega Code Archive

 
Categories / ASP.Net Tutorial / Page Lifecycle
 

Displaying URL information in ASP NET

< html>    <head>       <title>Submit a named parameter via POST</title>    </head> <body>    <form id="form1" action="NextPage.aspx" method="POST">       <h3>Name:</h3>       <input type="text" name="name">       <input type="submit">    </form> </body> </html> File: NextPage.aspx <%@ 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 ? <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 %> </body> </html>