Dov'è l'errore?

  • Creatore Discussione Creatore Discussione jan267
  • Data di inizio Data di inizio

jan267

Utente Attivo
6 Mar 2003
1.950
2
38
36
Milano
twitter.com
Dov`e` l`errore?

Ciao gente,
non e` che sapresti dirmi dove si trova l`errore in questo codice:
Codice:
<%@ Page Language="C#" Debug="True" %>
<%@ import Namespace="System.Net" %>
<script runat="server">
void Page_Load(Object sender, EventArgs e) {
myLabel.Text = ResolveIP(""&Request.QueryString["ip"].Trim()&"");
}
private string ResolveIP(string strIP) {
//Ritorna l'host di provenienza dell'IP
try {
IPHostEntry ipEntry;
ipEntry = Dns.Resolve(strIP);
return ipEntry.HostName;
} catch(System.Net.Sockets.SocketException se) {
return "sconosciuto";
}
}
</script>

<html>
<head></head>
<body>
<asp:Label id="myLabel" runat="server" />
</body>
Tnx :) bye
 
Re: Dov`e` l`errore?

Originally posted by jan267
Ciao gente,
non e` che sapresti dirmi dove si trova l`errore in questo codice:
Codice:
<%@ Page Language="C#" Debug="True" %>
<%@ import Namespace="System.Net" %>
<script runat="server">
void Page_Load(Object sender, EventArgs e) {
myLabel.Text = ResolveIP(""&Request.QueryString["ip"].Trim()&"");
}
private string ResolveIP(string strIP) {
//Ritorna l'host di provenienza dell'IP
try {
IPHostEntry ipEntry;
ipEntry = Dns.Resolve(strIP);
return ipEntry.HostName;
} catch(System.Net.Sockets.SocketException se) {
return "sconosciuto";
}
}
</script>

<html>
<head></head>
<body>
<asp:Label id="myLabel" runat="server" />
</body>
Tnx :) bye

Io lo so!:D
 
Cosi va meglio :)

<%@ Page Language="C#" Debug="True" %>
<%@ import Namespace="System.Net" %>
<script runat="server">
void Page_Load(Object sender, EventArgs e) {
myLabel.Text = ResolveIP("127.0.0.1");
}
private string ResolveIP(string strIP) {
try {
IPHostEntry ipEntry;
ipEntry = Dns.Resolve(strIP);
return ipEntry.HostName;
} catch(System.Net.Sockets.SocketException se) {
return "sconosciuto";
}
}
</script>

<asp:Label id="myLabel" runat="server" />
 

Discussioni simili