FrmServerMapPath
.NET프로그래밍/ASP.NET 3.5 SP1 2009. 10. 5. 20:33 |
==> [FrmServerMapPath.aspx] 소스 및 디자인
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FrmServerMapPath.aspx.cs" Inherits="FrmServerMapPath" %>
<!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>
현재 파일(웹 폼)의 물리적인 전체 경로 :
<asp:Label ID="Label1" runat="server"></asp:Label>
<br />
현재 스크립트 파일의 루트(웹서버상주소) 경로 :
<asp:Label ID="Label2" runat="server"></asp:Label>
</div>
</form>
</body>
</html>
-------------------------------------------------------------------------------------
==> [FrmServerMapPath.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 FrmServerMapPath : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// 현재 웹 폼의 서버측의 물리적 경로
this.Label1.Text = Server.MapPath("."); // 같은 경로
//현재 스크립트 파일의 루트 경로
this.Label2.Text =
Request.ServerVariables["SCRIPT_NAME"];
}
}
-------------------------------------------------------------------------------------
[실행결과]
'.NET프로그래밍 > ASP.NET 3.5 SP1' 카테고리의 다른 글
ASP.NET 주요 내장 개체(클래스)들 - Application 개체와 Session 개체 (0) | 2009.10.05 |
---|---|
FrmServerExecute (0) | 2009.10.05 |
ASP.NET 주요 내장 개체(클래스)들 - Server 개체 (0) | 2009.10.05 |
FrmRequestUserHostAddress (0) | 2009.10.05 |
FrmRequest (0) | 2009.10.05 |