【发布时间】:2011-05-31 07:33:36
【问题描述】:
这是我的场景:
我有一个带有 php、mySQL 的网站。我有一个软件应用程序,它有一个登录屏幕,并通过 http:
在网络上发送用户名和密码 public String GetWebPageSource(String pURL)
{
try
{
byte[] vReceivedBytes = null;
using (System.Net.WebClient vWebClient = new System.Net.WebClient())
{
vReceivedBytes = vWebClient.DownloadData(pURL);
}
int vBomLen = 3;
byte[] vStrippedBytes = new byte[vReceivedBytes.Length - vBomLen];
Array.Copy(vReceivedBytes, vBomLen, vStrippedBytes, 0, vReceivedBytes.Length - vBomLen);
return System.Text.Encoding.UTF8.GetString(vStrippedBytes);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
return null;
}
}
所以要发送用户名和密码,我会写:
GetWebPageSource("http://mywebsite.com/Login.php?username=stackoverflow&password=iscool")
并且 php 文件会输出一些文本,说明密码是被接受还是被拒绝。
但是这并不安全。所以我想让它安全...... https。集成https有多容易?代码会改变多少?我需要处理多少?什么对我来说是透明的。我是否必须检查 cookie 是否已经存在,如果不编写身份验证方法,或者是否已经提供了可以为我做的库?
【问题讨论】:
标签: c# .net authentication ssl https