网页重定向、跳转、内嵌

1、 asp.net网页 重定向示例:

http://60.205.185.168:8001/Pages/Redirect.aspx?https://fanyi.baidu.com/

Response.Redirect(redictUrl, true);    // 页面重定向跳转,可跳转其他站点
Server.Transfer(param, false);            // Server Transfer,不可跳转其它站点

 

Redirect.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplicationTest
{
    /// <summary>
    /// url网页重定向示例: http://localhost:5516/Redirect.aspx?https://www.baidu.com
    /// </summary>
    public partial class Redirect : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            String redictUrl = getParam();                                  // 获取重定向Url
            if(!redictUrl.Equals("")) Response.Redirect(redictUrl, true);   // 页面重定向跳转
            //Server.Transfer(param, false);    // Server不可跳转其它站点
        }

        /// <summary>
        /// 获取请求参数信息
        /// </summary>
        private String getParam(String LogName = "")
        {
            String Url = Request.Url.ToString();
            String param = "";
            if (Url.Contains("?"))
            {
                param = Url.Substring(Url.IndexOf("?") + 1);                // 获取参数信息

                if (LogName.Equals("")) LogName = this.GetType().Name;
                LogTool log = new LogTool(LogName);                         // 记录至log中
                log.WriteLine(param);
            }
            return param;
        }
    }
}

 

Redirect.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Redirect.aspx.cs" Inherits="WebApplicationTest.Redirect" %>

<%--<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
    </div>
    </form>
</body>
</html>--%>

 

2、html跳转示例:https://scimence.gitee.io/alipayhb


<html>
<head>
	<title>跳转首页</title>
	<meta http-equiv="refresh" content="0.2;url=http://www.scimence.club:8002/PageHB/Hb.aspx">

	<title>支付宝红包收款码制作工具</title>
    	<link rel="icon" href="http://www.scimence.club:8002/tools/HB_pic/favicon.ico" type="image/x-icon" />
    	<meta name="Keywords" content="红包,收款,收款码,红包码,红包收款码,收款红包码,红包码收款码合并,收款码红包码合二为一,支付宝,如何申请红包码,如何获取收款码,二维码,红包收款码制作,制作收款码,支付宝红包收钱码在哪,支付宝收钱码不能用红包,支付宝收钱码不能用了,支付宝收钱码怎么变成商家的,支付宝怎么推荐收钱码,支付宝收钱码怎么用,收钱码合并"/>
    	<meta name="Description" content="红包收款码:将红包码合并至收款码上。顾客:既能领红包,又能付款;商家:既能收款,又能收到红包返利。红包,收款,收款码,红包码,红包收款码,收款红包码,红包码收款码合并,收款码红包码合二为一,支付宝,如何申请红包码,如何获取收款码,二维码,红包收款码制作,制作收款码,支付宝红包收钱码在哪,支付宝收钱码不能用红包,支付宝收钱码不能用了,支付宝收钱码怎么变成商家的,支付宝怎么推荐收钱码,支付宝收钱码怎么用,收钱码合并" />
    	<meta name="viewport" content="width=device-width, initial-scale=0.5, minimum-scale=0.5, maximum-scale=1.0, user-scalable=no" />
    	<meta name="author" content="scimence"/>
    	<meta itemprop="dateUpdate" content="2018-10-08 23:45:10" />


</head>
<body>
</body>
</html>
<html>
<head>
  <meta http-equiv="refresh" content="1,url=http://www.baidu.com"/>
</head>
</html>

3、<object/>内嵌页面

<object id="Object1" data="https://www.baidu.com/" type="text/x-scriptlet" width="100%" height="1280" >

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    	<title>HongBao</title>
</head>
<body runat="server" class="back-color" id="body1">
    	<object id="Object1" data="https://www.baidu.com/" type="text/x-scriptlet" width="100%" height="1280" >
	</object>
</body>
</html>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值