Click here to Skip to main content
15,907,676 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
So I dont quite get why this shows me that there is an update availible.
Does the DownloadString function save the result permanentely so that if you execute the programm again the result will still be the same even if the answer has changed? If yes just reply with a yes.
If no please help me!

var Webpagestring01 = string.Empty;
            using (var web = new System.Net.WebClient())
                Webpagestring01 = web.DownloadString("https://www.dropbox.com/s/yqig5di1smlkjkl/update.txt?dl=0");

            if (Webpagestring01.Contains("2.0.0"))
            {
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine("                                                  Update Found!");
                Console.WriteLine();
                Console.ResetColor();
                Console.WriteLine("------------------------------------------------------------------------------------------------------------------------");
                Console.WriteLine("Press 1 to install the update or press 2 if you want to continue to the Menu");
                Console.WriteLine();
                Console.WriteLine("------------------------------------------------------------------------------------------------------------------------");
                int answer06 = Convert.ToInt32(Console.ReadLine());
                if (answer06 == 1)
                {
                    Process.Start("https://www.dropbox.com/sh/6gx6zf2lpy1u4xj/AAAEF7wgUrxYGX9v8PKvEmXna?dl=1");
                }
                else if (answer06 == 2)
                {
                    for (int i = 1; i <= 35; i++)
                    {
                        Console.WriteLine();
                    }
                    goto Menu;
                }
            }


What I have tried:

I tried to fix the problem by changing the names of the Webpagestring to Webpagestring01
Posted
Updated 14-Jan-17 6:03am

1 solution

If you load the string and save it to a file, you'll see that it is a complete webpage, together with the Javascript necessary to make it work.
And it contains the line:
return {"waitSeconds": 30, "map": {"modules/shims/react": {"__real_external/react": "external/react-15.3.1-prod", "external/react": "external/react-15.3.1-prod"}, "external/jquery_security_patch_bundle": {"jquery": "jquery", "__real_jquery": "jquery"}, "external/react-redux-3.1.0": {"redux": "external/redux-3.6.0"}, "*": {"external/react-dnd-scrollzone": "external/react-dnd-scrollzone-3.0.0", "external/react-dnd": "external/react-dnd-2.1.4", "external/tslib": "tslib", "langpack": "javascript/langpack/en", "external/immutable": "external/immutable-3", "external/redux-thunk": "external/redux-thunk-2.1.0", "external/react-dom/server": "external/react-dom/server-15.3.1-prod", "external/sjcl": "external/sjcl-1.0.3", "__real_jquery": "jquery", "external/videojs/video": "external/videojs/video-5.10.7", "external/react": "modules/shims/react", "external/react-redux": "external/react-redux-3.1.0", "__real_external/rsvp": "external/rsvp", "external/rsvp": "modules/shims/es6-promise", "external/react-router": "external/react-router-2.0.0",
Which contains the text you are searching for: "2.0.0"
There are several other instances of that string in the document.
At a guess, either it's not the page / document you want, or your search string is too simple and catching a false positive.
But we'd need to know a lot more about exactly what you are trying to do and what you expect to get before we could help you fix the problem!
 
Share this answer
 
Comments
GrabiCraft 14-Jan-17 12:08pm    
The doc I wrote should contain the current Version number of my Programm and the If Statement should decide wether to download the Version from online or not. I expect to get the plain Text which I wrote in the doc, so the Version number. It should check for updates everytime the program is started.
OriginalGriff 14-Jan-17 12:27pm    
So you need to look at the string you fetch, and see if that is the document you expect.
I can't do that - I have no idea what your document should look like.
Try saving the string to a file using File.WriteAllText and look at teh result with a text editor.
GrabiCraft 14-Jan-17 13:01pm    
My doc should look like 210420081.0.0.0 written out in plain text.
Sorry but im a beginner and after searching on the internet for half an hour I give up. Please link me a tutorial or look at the string
GrabiCraft 14-Jan-17 13:33pm    
Solved now. Thx. Now I used pastebin instead of Dropbox.
OriginalGriff 14-Jan-17 13:39pm    
You're welcome!

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