Remote url:https://121.199.16.229:8890/generate.cgi?rbid=1001&esn=22021434025005&pic=png&count=1& Pix=250&cor=lo&comm=%e6%b5%a6%e6%b1%9f%e6%b8%b8%e8%a7%881%e5%8f%b7%e9%be%99%e8%88%b9%2f%e5%b7%a5%e8%a1 %8c%e5%8f%b7%ef%bc%8c2013%e5%b9%b46%e6%9c%881%e5%8f%b7%ef%bd%9e2013%e5%b9%b46%e6%9c%8831%e5%8f%b7%ef%bc%8c14% 3a00
After execution: A picture address such as Https://121.199.16.229:8890/cgi/1001313097265699.png is generated
How to get the URL of this image by accessing the remote URL inside the program
Reply:
HttpWebRequest set the autoredirection on it. It will automatically handle 301 jumps.
Add System.Net and System.Security two DLLs and introduce the appropriate namespaces.
Static voidMain (string[] args) {HttpWebRequest WebRequest= (HttpWebRequest) webrequest.create ("https://121.199.16.229:8890/generate.cgi?rbid=1001&esn=22021434025005&pic=png&count=1&pix= 250&cor=lo&comm=%e6%b5%a6%e6%b1%9f%e6%b8%b8%e8%a7%881%e5%8f%b7%e9%be%99%e8%88%b9%2f%e5%b7%a5%e8%a1%8c% E5%8f%b7%ef%bc%8c2013%e5%b9%b46%e6%9c%881%e5%8f%b7%ef%bd%9e2013%e5%b9%b46%e6%9c%8831%e5%8f%b7%ef%bc%8c14%3a00 "); Servicepointmanager.servercertificatevalidationcallback=NewSystem.Net.Security.RemoteCertificateValidationCallback (CheckValidationResult);//Verifying server certificate callbacks automatic validationWebResponse WebResponse =Webrequest.getresponse (); Console.WriteLine (WebResponse.ResponseUri.AbsoluteUri);//Output https://121.199.16.229:8890/cgi/1001363993292848.png } Public Static BOOLCheckValidationResult (Objectsender, X509Certificate certificate, X509chain chain, sslpolicyerrors errors) { //Always accept return true; }
How to use the program to get the image address after the remote URL executes