[Closed] Difficult question System.Net.WebRequest
I need to login one time to a website and download files with maxscript.
The website is using:
- Login
- Password
- Captcha (unique simbols)
Usual webbrowser can save login and password, so that the user will not have to login everytime before downloading.
If no captcha, I could also make a function to save Login and Password to a file and then to use them in case I get login page instead of downloading file.
Question: If even I get the image capture inside 3d max, and send the Login, password and the characters manually one time, will System.Net.WebRequest be able to remember somehow that informaton, and will it allow to download?
Or should I go another direction, to make a script wich will download the file from usual webbrowser?
With my experience,System.Net.WebRequest sometimes cannot connect intenet by dns problem via maxscript,even it seems you have no problem visit web page using webbrowser at that time.my script used System.Net.WebRequest to get data from my site,sometimes user’s machine cannot recieve data so that my script cannot work,now I use some code like below to get web data
timeouts=1000 --timeout of course
ur_path="http://www.google.com" --your site data path
rollout httpSock "httpSock" width:0 height:0 (activeXControl port "MSXML2.ServerXMLHTTP" setupEvents:false releaseOnClose:false);
createDialog httpSock pos:[-100,-100];destroyDialog httpSock;
gethttp=httpSock.port
httpSock=undefined
gethttp.SetTimeouts timeouts timeouts timeouts timeouts
gethttp.open "GET" ur_path false
gethttp.send();
last_data=gethttp.responseText --your last data from reading your site
about Login and password,I think you can embed a web page,
1.using System.Net.WebRequest or other way to read your user Login name and password
2.send them to embed webpage,so that can store in your cookie?
but I have never test,just know embed webpage is very easy
rollout webbrowser_rollout "Web Test" width:600 height:600
(
edittext edt_url "URL:" text:"http://www.google.com"
dotNetControl wb "System.Windows.forms.WebBrowser" pos:[10,22] width:580 height:570
fn openURL urlString = (
wb.url = dotNetObject "System.Uri" urlString )
on edt_url entered txt do openURL txt
on webbrowser_rollout open do openURL edt_url.text
)
createdialog webbrowser_rollout
I think you can hide the embeded the webpage,just in order to store the data,does not visible
I understood that this should be done with CookieContainer.
Is anybody here that knows smth about it?
I found a simillar code, just in VB.net but without captcha
http://howtostartprogramming.com/vb-net/vb-net-tutorial-52-httpwebrequest-cookiecontainer/