①response.redirect这个跳转页面的方法跳转的速度不快,因为它要走2个来回(2次postback),但他可以跳 转到任何页面,没有站点页面限制(即可以由雅虎跳到新浪),同时不能跳过登录保护。但速度慢是其最大缺陷!redirect跳转机制:首先是发送一个http请求到客户端,通知需要跳转到新页面,然后客户端在发送跳转请求到服务器端。需要注意的是跳转后内部空间保存的所有数据信息将会丢失,所以需要用到session。
实例
Example that uses Redirect [C#; ]
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 throw an HttpException to terminate.
response.Redirect("", false);
}
}
}
Result of the page
HTTP/1.1 302 Found
Content-Type: text/html; charset=utf-8
如果觉得《c# aspx转为html asp.net(c#)网页跳转七种方法小结》对你有帮助,请点赞、收藏,并留下你的观点哦!