Sto creando un sito Web in Visual Studio 2010 (in Visual Basic) e ho davvero bisogno di sapere come ottenere l'URL da un'istruzione VB (nel file aspx.vb, a pagina carica).Ottieni l'URL corrente in vb.net
9
A
risposta
13
C'è uno few properties che può darti le informazioni. Ecco un esempio.
Dim url As String = HttpContext.Current.Request.Url.AbsoluteUri
Dim path As String = HttpContext.Current.Request.Url.AbsolutePath
Dim host As String = HttpContext.Current.Request.Url.Host
0
VB.NET
Imports System.Net.Dns
Imports System.Net
Dim host As String = HttpContext.Current.Request.Url.Host
Dim hostname As IPHostEntry = Dns.GetHostEntry(host)
Dim ip As IPAddress() = hostname.AddressList
Label1.Text = ip(1).ToString()
0
Prova questo.
.html Pagina
<div>
<h1> Url: </h1> <asp:Label ID="Label1" runat="server" Text=""></asp:Label>
</div>
in .vb Pagina
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = Request.Url.ToString();
}