Method 1:
1. Request the home page to obtain the cookie and save the cookie for backup (Note: session is also a cookie)
2. Request an additional code and display it on your own page. Note that when requesting an additional code, you must use the Cookie obtained in step 1 to request it, after the request is complete, if a new Cookie exists, it will be saved.
3. manually enter the additional code and post it to the final page.
------------------------------------------------------------------------------
Method 2:
1. First, you need to obtain cookies from the target website. You can use different methods for different websites.
Generally, you need to first request the page where the verification code is located, so that the server will write the cookies to your container.
Of course, you can also obtain the cookie that has been stored in IE from the local cache, but this is very easy on the. net3.0 and later platforms. on platforms lower than 3.0, you need to call APIs on the platform to obtain the cookie.
2. Simple:
In your code, request the page where the image is located before requesting it. Of course, when you request an image, you must specify the same cookiecontainer object.
Httpwebrequest request = (httpwebrequest) webrequest. Create (URL );
Httpcontext. Current. session ["pagecookie"] = Req. cookiecontainer. getcookieheader (New uri ("Host of the cookie on the requested site ")));
--------------------------------------------
When you need to append a cookie next time:
Httpwebrequest Req = (httpwebrequest) webrequest. Create (URL );
Req. headers. Add ("Cookie:" + httpcontext. Current. session ["pagecookie"]. tostring ());