using System;
using System.Web.UI;
namespace WebApplication1
{
public partial class List : Page
{
protected void Page_Load(object sender, EventArgs e)
{
// Get response.
var response = base.Response;
// Redirect temporarily.
// ... Don't throw an HttpException to terminate.
response.Redirect("http://www.1sucai.cn", false);
}
}
}
HTTP/1.1 302 Found Content-Type: text/html; charset=utf-8 Location: http://www.1sucai.cn Server: Microsoft-IIS/7.0 Date: Fri, 13 Aug 2010 21:18:34 GMT Content-Length: 144 <html> <head> <title>Object moved</title></head><body> <h2>Object moved to <a href=http://www.1sucai.cn/list/index_1.htm>here</a>.</h2> </body> </html>
private void Button1_Click
(object sender, System.EventArgs e)
{
Server.Transfer("webform2.aspx");
}
public string Name
{
get
{
return TextBox1.Text;
}
}
public string EMail
{
get
{
return TextBox2.Text;
}
}
private void Page_Load
(object sender, System.EventArgs e)
{
//创建原始窗体的实例
WebForm1 wf1;
//获得实例化的句柄
wf1=(WebForm1)Context.Handler;
Label1.Text=wf1.Name;
Label2.Text=wf1.EMail;
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="WebForm1.aspx.cs" Inherits="WebForm1" %>
<!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:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
</div>
</form>
</body>
</html>
.net代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class WebForm1 : System.Web.UI.Page
{
public string Time
{
get { return DateTime.Now.ToString(); }
}
public string TestFun()
{
return "Function of WebForm1 Called";
}
protected void Page_Load(object sender, EventArgs e)
{
Context.Items.Add("Context", "Context from Form1");
}
protected void Button1_Click(object sender, EventArgs e)
{
//this.TextBox2.Text =Request ["TextBox1"].ToString ();
Server.Transfer("WebForm2.aspx", true);//第二个参数为false时,WebForm2.aspx中不能获得TextBox1的内容
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有