属性无法正常工作

编程入门 行业动态 更新时间:2024-10-25 13:14:25
本文介绍了属性无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

您好,我使用C#VS 2010编写了一个应用程序,该应用程序从Internet位置调用PDF页面并将其显示在IFrame中的内部Adobe查看器中。它似乎工作得很好,但后来我更新了一个PDF文档,它仍然称为旧文档。我甚至从在线文件夹中删除了该文件,它仍然加载它。我重新启动了程序并没有任何区别。我无法理解为什么它没有看到同名的新文件。完整的代码如下:

// 使用此从数据库中获取正确页面名称的方法 string item = GetPdf( 2 ); if (item == string .Empty) { ClientScriptManager script = Page.ClientScript; if (!script.IsClientScriptBlockRegistered( this .GetType(), Alert)) { script.RegisterClientScriptBlock( this .GetType(), Alert, alert('抱歉,可以找到此文档。'), true ); return ; } } // 将项目和位置添加到属性列表中传递给读者 else { pdfIframe.Attributes.Add( src,item); }

任何帮助表示赞赏。谢谢,Pat。 我尝试过: 我尝试完全删除旧文档。我重新启动了该程序。我跑了堆栈跟踪。我在每一步都使用了断点。

解决方案

你有没有尝试清除浏览器缓存? 如何清除网络浏览器的缓存,Cookie和历史记录? [ ^ ] 另一种选择是添加随机查询字符串到pdf的链接。 假设PDF文档的链接是/ document?id = 2,新链接应该是/ document?id = 2& r = 79834234,/ document?id = 2& r = 987987897 这种情况​​下,愚蠢的浏览器会认为这是两个不同的请求,而不是从缓存中提取它。

Hello, I wrote an application using C# VS 2010 that calls an PDF page from an internet location and displays it on an internal Adobe viewer in an IFrame. It seemed to work perfectly, but then I updated one of the PDF docs and it still calls the old one. I even deleted the file from the online folder and it still loads it. I restarted the program and it made no difference. I cannot understand why it does not see the new document by the same name. The complete code is below:

//Use this method to get the correct page name from the DB string item = GetPdf(2); if (item == string.Empty) { ClientScriptManager script = Page.ClientScript; if (!script.IsClientScriptBlockRegistered(this.GetType(), "Alert")) { script.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('Sorry, this document canot be found. ')", true); return; } } //Add the items and location to the attribute list to pass to the reader else { pdfIframe.Attributes.Add("src", item); }

Any help appreciated. Thank You, Pat. What I have tried: I tried removing the old document completely. I restarted the program. I ran a stack trace. I used break points to at each step.

解决方案

have you try clear the browser cache? How do I clear my web browser's cache, cookies, and history?[^] Another alternative is to add a random querystring to the link to the pdf. Let said the link to PDF document is /document?id=2, the new link should be /document?id=2&r=79834234 , /document?id=2&r=987987897 That case the silly browser will think those are two different request instead of pulling it from the cache.

更多推荐

属性无法正常工作

本文发布于:2023-11-08 07:58:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1568802.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:无法正常   属性   工作

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!