pdering
asked on
How to post url in C#
I need to "post" a web url in the background and repeat it every 60 seconds. Would prefer not to use the Windows Scheduler.
For example....
http://www.domain.com/index.php?userkeepalive=user1
I don't need to view the page - just hit the url. (Kind of like curl). How would I do this in C#?
For example....
http://www.domain.com/index.php?userkeepalive=user1
I don't need to view the page - just hit the url. (Kind of like curl). How would I do this in C#?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
What is the difference between UploadString and DownloadString?
@CodeMasterAlex
@pdering
I would do it in a different way and not let the thread sleep for a minute every time. You can use a Timer control to do work on a timed interval.If it's a Console application, does it really matter?
@pdering
What is the difference between UploadString and DownloadString?As CodeMasterAlex indicated, you would use UploadString to perform a POST.
@kaufmed:
I don't know what kind of application it is. I don't think it would really matter, it is more a matter of preference. Reading the remarks at http://msdn.microsoft.com/en-us/library/system.timers.timer%28v=vs.100%29.aspx suggests it is a better option in this case.
I don't know what kind of application it is. I don't think it would really matter, it is more a matter of preference. Reading the remarks at http://msdn.microsoft.com/en-us/library/system.timers.timer%28v=vs.100%29.aspx suggests it is a better option in this case.
Open in new window
Also, the WebClient's DownloadString requests (HTTP GET) a URL whereas the UploadString performs a HTTP POST.