属性无法正常工作 [英] Attribute not working correctly

查看:99
本文介绍了属性无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我使用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.


这篇关于属性无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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