Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 17:14

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[C#] Webclient / HttpWebRequest Refresh

Discussion on [C#] Webclient / HttpWebRequest Refresh within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1

 
Njahs's Avatar
 
elite*gold: 574
Join Date: Nov 2010
Posts: 2,498
Received Thanks: 726
[C#] Webclient / HttpWebRequest Refresh

Guten Tag zusammen,

ich habe ein 'kleines Problem mit meinem
neuen C# Projekt.
Ich muss, soweit dies möglich ist,
eine Seite (via Webclient oder HttpWebRequest)
alle paar Minuten Neu laden (Refresh / F5),
ohne diese komplett neu aufzurufen / zu "deklarieren".

-> Ich habe zZ noch nichts hilfreiches darüber gefunden.
Danke!

MfG
Njahs is offline  
Old 11/29/2012, 17:34   #2
 
.SkyneT.'s Avatar
 
elite*gold: 273
Join Date: Sep 2010
Posts: 1,831
Received Thanks: 786
Gehört in die .NET Section.

Zum Problem:
Quote:
ohne diese komplett neu aufzurufen / zu "deklarieren".
Dafür brauchst du einen Cache, wie das in C# am besten geht
kann ich dir leider nicht sagen.
.SkyneT. is offline  
Old 12/01/2012, 18:27   #3

 
Njahs's Avatar
 
elite*gold: 574
Join Date: Nov 2010
Posts: 2,498
Received Thanks: 726
Quote:
Originally Posted by .SkyneT. View Post
Gehört in die .NET Section.
Huch, ganz überlesen, danke!

BTT: Könnte man ein Beispiel bekommen?
Njahs is offline  
Old 12/02/2012, 23:27   #4
 
ĤΛƇҠ's Avatar
 
elite*gold: 40
Join Date: Mar 2011
Posts: 771
Received Thanks: 352
Erstell ein neues projekt, pack einen webbrowser drauf, mach einen timer, stell den intervall auf 600000(5min), un benutz bei Timer1_Tick Webbrowser.Refresh();

sollte so funzen, garantiere ich ^^

Falls es auch pixel sein darf bastel dir am besten was mit autoit
ĤΛƇҠ is offline  
Thanks
1 User
Old 12/03/2012, 17:00   #5
 
.SkyneT.'s Avatar
 
elite*gold: 273
Join Date: Sep 2010
Posts: 1,831
Received Thanks: 786
Quote:
Originally Posted by ĤΛƇҠ View Post
Erstell ein neues projekt, pack einen webbrowser drauf, mach einen timer, stell den intervall auf 600000(5min), un benutz bei
5 min -> 300s -> 300 000ms
.SkyneT. is offline  
Thanks
1 User
Old 12/04/2012, 12:56   #6
 
ĤΛƇҠ's Avatar
 
elite*gold: 40
Join Date: Mar 2011
Posts: 771
Received Thanks: 352
oh ja, sorry hast recht, hatte wohl 10 min im kopf ^^
ĤΛƇҠ is offline  
Old 12/04/2012, 18:35   #7


 
MrSm!th's Avatar
 
elite*gold: 7110
Join Date: Jun 2009
Posts: 28,913
Received Thanks: 25,413
Arrow C/C++ -> .NET Languages

#moved
MrSm!th is offline  
Thanks
1 User
Old 12/05/2012, 17:47   #8
 
elite*gold: 60
Join Date: Dec 2012
Posts: 1,359
Received Thanks: 36
Was benutze du denn eigentlcih jetzt.?
Webclient oder HttpWebRequest?

Ich würde es mit eine Thread und eine whil schleife machen.
Dann machst du Thread.Sleep(10000) am ende und dann machst du einfach bei der whil schleife als bedingung (true).

Das denke ich wäre am einfachsten.

Wenn du noch fragen dazu hast kannst du mir gerne eine Pn senden
wunderdie is offline  
Old 12/06/2012, 11:23   #9
 
Super Aids's Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 950
Something like this?
Code:
static void Refresh(string url, int interval) // interval = seconds
{
   Stream httpStream;
   StreamReader httpReader;		
   HttpWebResponse response;
   WebRequest request;

   while (true)
   {
       	request = WebRequest.Create(url);
	response = (HttpWebResponse)request.GetResponse();
						
	httpStream = response.GetResponseStream();
	httpReader = new StreamReader(httpStream);
	string httpResponse = httpReader.ReadToEnd();

        // do stuff with response perhaps?

       System.Threading.Thread.Sleep(interval * 1000);
   }
}
Ex.

Code:
Refresh("http://google.com/", (5 * 60) /* Every 5 min */);
And if you don't want it to stop the main thread use this:
Code:
new System.Threading.Thread(() => {
Refresh("http://google.com/", (5 * 60) /* Every 5 min */);
}).Start();
Super Aids is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
How to make an RSPS webclient Form
05/04/2012 - Runescape Private Server - 1 Replies
Created By SwagCoder All Made By Me, I Hope you Enjoy, Need help? PM me or email me at [email protected] ________________________________ This Is The Create.php Witch is Just the start form. ------------------------------------------------- -------------------------------------------------- <center><form enctype="multipart/form-data" action="Develop.php"method="POST&qu ot;> <input name="name" value="" style="background-color:black;color:ffffff;bo rder:3px solid ffffff" /><br><input name="ip"...
Ragescape Server [24/7][Webclient]
03/14/2012 - Runescape Private Server - 1 Replies
Welcome to The Official RageScape Rsps Thread Ragescape is a runescape private server with custom items, Easier Xp, and much more. Features: Custom Buttons,Skins. Ranks can turn into npc's Custom Quests Custom Minigames Webclient Downloadable Client
Runescape Webclient?
02/26/2012 - Runescape Private Server - 0 Replies
Hallo liebe Community, könnte mir jemand sagen, wie man einen Webclient erstellt? Ich möchte einen Runescape Server aufmachen der auf einem Webclienten läuft. Hoffe jemand hat eine Antwort. MFG Bomba :confused:
OdinBSD 24/7 - Great Community - Webclient
12/14/2011 - Runescape Private Server - 3 Replies
http://i56.tinypic.com/161m3o0.png Website Forum Client Webclient Donate Now! Now looking for staff, visit the forums and register to find your spot!
(Question)Webclient
04/16/2010 - Runescape - 5 Replies
well i want to know if there is a list with webclient and non web client like Webclient Server name: Non Web Client



All times are GMT +2. The time now is 17:15.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.