Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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:
C#
//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.
Posted
Updated 18-Feb-17 16:39pm

1 solution

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.
 
Share this answer
 
v2
Comments
PDTUM 19-Feb-17 1:07am    
Thank You Bryian. I figured this out just after I sent the question (after initially losing half a day), but your solution was correct and your supplemental addtional fix sounds like a good idea and is appreciated. It is my pleasure to mark this as the correct answer. Pat.
Bryian Tan 19-Feb-17 1:33am    
@Pat
You're very welcome and I appreciate that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900