Cross-Page Posting
Cross-Page Posting이란 타겟을 다른 대상 페이지로 하여 현재 페이지를 서버로 전송하는 프로세스 입니다. 밑의 예제는 정보를 보내는 페이지(Default.aspx)와 정보를 받아서 그 정보를 보여주는 페이지(CrossPagePosting.aspx)로 구성되어 있습니다.
Default.aspx 의 Body 부분
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Button" PostBackUrl="~/CrossPagePosting.aspx" />
</div>
</form>
CrossPagePosting.aspx.cs파일
protected void Page_Load(object sender, EventArgs e)
{
if (PreviousPage != null)
{
TextBox t;
t = (TextBox)PreviousPage.FindControl("TextBox1");
Response.Write("Cross-Page Posting : " + t.Text);
}
else
{
Response.Write("Cross-Page Posting fail");
}
}
RECENT COMMENT