iframe Erorr“无法找到资源” [英] iframe Erorr "the resource cannot be found"

查看:128
本文介绍了iframe Erorr“无法找到资源”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



i创建了一个网页表格,在网页上显示pdf文件



Hi
i have created a web form to display a pdf file in web

string phy_path = FileUpload1.PostedFile.FileName;// to get full file path
 string path = MapPathReverse(phy_path);
 Session["path"] = path.ToString();
 PDF_frame.Attributes.Add("src", path);





此代码代码背后



这个设计中的代码





this in code code behind

and this code in design

<iframe id="PDF_frame"  runat="server"  title="document view" 

            type="application/pdf" align="bottom" > </iframe>  





但是当我运行此代码时,在框架中显示这个内容





but when i run this code , display this in the frame

Server Error in '/Ajax' Application.

The resource cannot be found.

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly. 

Requested URL: /Ajax/~/OLE+Automation+English.pdf

Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433





我该怎么办?



what can i do ??

推荐答案

/Ajax/~/OLE+Automation+English.pdf

您可以亲眼看到预期的路径看起来不正确。 (它在路径字符串之间有tilda)



这是一个相对路径问题。有一种方法可以处理URL'。阅读: ResolveUrl [ ^ ]。



我建议您在设置控件/图像源之前使用此提示并正确解析路径:解决多文件夹网站中的路径 [ ^ ]



做这样的事情也有帮助: ResolveUrl(路径);
/Ajax/~/OLE+Automation+English.pdf
You can see for yourself that the path expected does not look like correctly formed. (It has tilda in between a path string)

It is a relative path issue. There is a method exposed to handle URL''s. Have a read: ResolveUrl[^].

I would suggest you to use this Tip and resolve the path correctly before setting the control/image source: Resolving Paths in a Multi-Folder WebSite[^]

Doing something like this can also help: ResolveUrl(path);


这篇关于iframe Erorr“无法找到资源”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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