简体   繁体   中英

Ensuring Secure HTTPs Connection

Well i am implementing a Account Login system in my application in which i want to make sure that all the connections are secure so the user can't simply redirect the client connection to a mimicked server and gain access to the app without my permission. So here is the procedure i am imagining.

1- The HttpClient Connects to my SSL page.

2- Makes sure that the connection is secure (maybe by checking the certificate or something).

3- If the connection is secure it sends out the login credentials.

4- It receives the answer and if the account is valid it goes on, if not it terminated the connection.

So as you see my plane is very simple and i think it will be good to prevent some abusers or hacker from gaining access to my app without my permission and it relays on the powerful SSL certificate system; However, i don't know how could i implement this in real code so i really need your help illustrating how could i make sure that the HttpClient has connected to my real server using SSL and not anyone's fake server.

Here is all you need - SSL certificate validity/match to domain name is checked by default.

var c = new System.Net.Http.HttpClient();
Console.Write(c.GetStringAsync("https://www.facebook.com/").Result);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM