To solve the 12306.cn site verification code to obtain prompt "the underlying co

Recommended for you: Get network issues from WhatsUp Gold. Not end users.
https://dynamic.12306.cn/otsweb/passCodeAction.do?rand=sjrand&0.8967564508222368

This is the picture of access.

You see, is the Https website, that is needed to access the certificate, the only obtain a certificate on the line, as follows

First, input the website directly in the browser and enter

Then click the following picture location

There will be the following interface

I choose detailed information is copied to the file

Second projects in the next step, is the Base64 code

The certificate to select a location that is also a need to write code position

Then the next click finish on the line

When you read this you succeed.

I use my Httphelper code.

/// <summary>
/// An array of bytes generated picture
/// </summary>
/// <param name="Bytes">An array of bytes</param>
/// <returns>The picture</returns>
private Image byteArrayToImage(byte[] Bytes)
{
    MemoryStream ms = new MemoryStream(Bytes);
 
    Image outputImg = Image.FromStream(ms);
    return outputImg;
 
}
 
private void Form1_Load(object sender, EventArgs e)
{
    HttpHelper http = new HttpHelper();
    HttpItem item = new HttpItem()
    {
        URL = "https://dynamic.12306.cn/otsweb/passCodeAction.do?rand=sjrand&0.8967564508222368",//URL necessary items    
        Method = "get",//The URL option the default is Get   
        CerPath = "D:\\123.cer",//Certificate absolute path option does not need the certificate can not write this parameter      
        ResultType = ResultType.Byte
    };
    HttpResult result = http.GetHtml(item);
    //Access to images
    Image im = byteArrayToImage(result.ResultByte);
    pictureBox1.Image = im;
}

The implementation effect are as follows

Here the problem is solved.

You feel you can to recommend it or give suggestions can also. Thanks a million!

It is to teach you how to use the Https site's certificate, if only that the 12306 sites are not needed, because he can be accessed directly by Http

http://dynamic.12306.cn/otsweb/passCodeAction.do?rand=sjrand&0.8967564508222368

Is the above address is the same can access. Ha-ha


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Lucien at November 15, 2013 - 10:17 PM