use*_*084 0 c# asp.net security ssl client-server
我有我公司产品的图形用户界面.我想保护在客户端和服务器之间来回发送的数据.
SSL是其中一个选择吗?如果是的话,请告诉我如何在我的应用程序代码中实现它的步骤.
我需要购买证书还是可以制作..这是最好的选择?
任何帮助表示赞赏.谢谢..
我正在使用FormsAuthenticationTicket登录,如下所示:
Session["userName"] = UserName.Text;
Session["password"] = Password.Text;
Session["domain"] = Domain.Text;
string role = "Administrators";
// Create the authentication ticket
FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, // version
UserName.Text, // user name
DateTime.Now, // creation
DateTime.Now.AddMinutes(60),// Expiration
false, // Persistent
role); // User data
// Now encrypt the ticket.
string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
// Create a cookie and add the encrypted ticket to the
// cookie as data.
HttpCookie authCookie =
new HttpCookie(FormsAuthentication.FormsCookieName,
encryptedTicket);
// Add the cookie to the outgoing cookies collection.
Response.Cookies.Add(authCookie);
// Redirect the user to the originally requested page
Response.Redirect(FormsAuthentication.GetRedirectUrl(UserName.Text, false));
Run Code Online (Sandbox Code Playgroud)
我不确定这有多安全?有什么建议.
SSL是其中一个选择吗?
这是唯一明智的一个
如果是的话,请告诉我如何在我的应用程序代码中实现它的步骤.
假设您正在处理浏览器(而不是您自己的客户端应用程序,然后通过HTTP与服务器通信).您没有使用SSL接近您的应用程序代码(除了确保您的URI是https的).
您只需在服务器上安装SSL证书.
我需要购买证书还是可以制作..这是最好的选择?
您可以生成自签名证书,但这会产生关于用户浏览器中信任的可怕警告.如果用户在技术上精通或者您有资源在所有客户端上安装证书(并将其标记为可信),那么这很好.否则你可能应该买一个.
| 归档时间: |
|
| 查看次数: |
294 次 |
| 最近记录: |