如果我们的道路在我们的项目旁边,我们怎样才能给予我可靠的控制权。 [英] How can we Give Sourse To I frmae control if Our Path Is out side our porjects.

查看:68
本文介绍了如果我们的道路在我们的项目旁边,我们怎样才能给予我可靠的控制权。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的aspx页面中有I-Frame控件

我的项目路径在C盘上

我想给一个F盘路径到I帧控制作为来源。那我该怎么做呢?

解决方案

你可以通过读取给定路径的内容来创建aspx页面来渲染html。例如



  protected   void  Page_Load( object  sender,EventArgs e)
{
string file = Request.QueryString [ file];
Response.Write(File.ReadAllText(Path.Combine( @ D:\ share,file)));
}





我们将文件名作为QueryString发送到此页面,我们可以从其他驱动器读取文件并写入回复。

现在我们有一个页面可以像ifram一样给出ifram的src属性



 <   iframe     id   =  if1    runat   =  server    src   =  Default.aspx?file = HTMLPage1.htm >  <   / iframe  >  


I have I-Frame Control in my aspx page
and my project path is on C drive
and i want to give a F Drive path to I frame control as a source. so how can i do these thing?

解决方案

you can create aspx page to render html by reading the content of given path. for example

protected void Page_Load(object sender, EventArgs e)
{
    string file = Request.QueryString["file"];
    Response.Write(File.ReadAllText(Path.Combine(@"D:\share", file)));
}



we send file name to this page as QueryString and we can read the file from some other drive and write to response.
now we have page which can give as src property of ifram like below

<iframe id="if1" runat="server" src="Default.aspx?file=HTMLPage1.htm"></iframe>


这篇关于如果我们的道路在我们的项目旁边,我们怎样才能给予我可靠的控制权。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆