新闻建站cms系统、政府cms系统定制开发

广州网站建设公司-阅速公司

asp.net新闻发布系统、报纸数字报系统方案
/
http://www.ysneo.com/
广州网站建设公司
您当前位置:首页>网站技术

网站技术

https网站访问iframe下的http内容

发布时间:2020/11/10 14:48:52  作者:Admin  阅读:1800  

广告:阿里云采购优惠专区

如何在https站点的iframe中允许http内容:

解决方案:新建一个代理页面HttpsPage.aspx,在服务器中访问http内容(少数有效)

前端代码:

<%string weixinpay="";
if (ViewData["weixinpay"]!=null)
weixinpay= ViewData["weixinpay"].ToString();
string ifaurl=payApi+"weixinpay.aspx?body="+weixinpay;
if (Request.Url.ToString().ToLower().Contains("ttps://"))
ifaurl=webd+"Jqueryfile/HttpsPage.aspx?url="+ifaurl+"&http="+payApi; %>

<div class="code_pic" id="showWechatUrl"><iframe src="<%=ifaurl%>" frameborder="0" scrolling="no"></iframe></div>

后端代码:

string url = "";
if (Request.QueryString["url"] != null)
url = Request.QueryString["url"].ToString();
string http = "";  //相对网址转为 http互联网网址
if (Request.QueryString["http"] != null)
http = Request.QueryString["http"].ToString();
if (url != "")
{

//Response.Write(url);
string res = HttpService.Get(url);

Regex Areareg3 = new Regex(@"src=""(.*?)""", RegexOptions.IgnoreCase | RegexOptions.Compiled);
res = Areareg3.Replace(res, "src=\""+http+"$1\"");

Regex Areareg2 = new Regex(@"href=""(.*?)""", RegexOptions.IgnoreCase | RegexOptions.Compiled);
res = Areareg2.Replace(res, "href=\"" + http + "$1\"");
Response.Write(res);
}
Response.End();

广告:阿里云新人采购专场

相关文章
https
iframe
cms新闻系统购买咨询
扫描关注 广州阅速软件科技有限公司
扫描关注 广州阅速科技