FrmRequestUserHostAddress
.NET프로그래밍/ASP.NET 3.5 SP1 2009. 10. 5. 14:56 |
==> [FrmRequestUserHostAddress.aspx] 소스 및 디자인
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FrmRequestUserHostAddress.aspx.cs" Inherits="FrmRequestUserHostAddress" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
현재 접속자의 IP주소 얻기<br />
<br />
<asp:Label ID="Label1" runat="server"></asp:Label>
<br />
<asp:Label ID="Label2" runat="server"></asp:Label>
<br />
<asp:Label ID="Label3" runat="server"></asp:Label>
</div>
</form>
</body>
</html>
-------------------------------------------------------------------------------------
==> [FrmRequestUserHostAddress.aspx.cs] 소스
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class FrmRequestUserHostAddress : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//현재 접속자의 IP주소를 얻는 3가지 방법
this.Label1.Text = Request.UserHostAddress;
Label2.Text = Request.ServerVariables["REMOTE_HOST"];
Label3.Text = Request.ServerVariables["REMOTE_ADDR"];
}
}
-------------------------------------------------------------------------------------
[실행결과]
'.NET프로그래밍 > ASP.NET 3.5 SP1' 카테고리의 다른 글
FrmServerMapPath (0) | 2009.10.05 |
---|---|
ASP.NET 주요 내장 개체(클래스)들 - Server 개체 (0) | 2009.10.05 |
FrmRequest (0) | 2009.10.05 |
ASP.NET 주요 내장 개체(클래스)들 - Request 개체 (0) | 2009.10.05 |
FrmResponseRedirect (0) | 2009.10.05 |