==> [FrmResponseRedirect.aspx] 소스 및 디자인



<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FrmResponseRedirect.aspx.cs" Inherits="FrmResponseRedirect" %>

 

<!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>

        <input type="button" value="이동" onclick="location.href='http://www.dotnetkorea.com';" /> <!-- JavaScript 방식 -->

   

        <asp:Button ID="btnDotNetKorea" runat="server" Text="닷넷코리아로 이동" onclick="btnDotNetKorea_Click" /> <!-- ASP.NET Response.Redirect 개체(클래스) 사용하는 방식 -->

    </div>

    </form>

</body>

</html>

 







-------------------------------------------------------------------------------------




==> [FrmResponseRedirect.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 FrmResponseRedirect : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

 

    }

    protected void btnDotNetKorea_Click(object sender, EventArgs e)

    {

        // 이동

        Response.Redirect("http://www.dotnetkorea.com/");

    }

}

 





-------------------------------------------------------------------------------------




[실행결과]
--> 웹페이지 첫화면




--> '이동' 또는 '닷넷 코리아로 이동'버튼을 누른 후 해당 URL로 넘어간 화면.





Posted by holland14
: