如何使用C#清除https网站中的SSL状态?
解决方案 »
- 搜索引擎地址栏问题,求教!!!
- asp.net 中如何实现在Textbox只允许输入长度小于13数字字符??
- 怎样令过宽的数据换行
- access问题!!!
- 如何从一段Html代码中提取出<img src="........">中src的值?
- 怎么解决DataGrid分页问题呢?我很困惑 因为我真的想不出什么好办法了!
- JSON转化问题
- 在VS2012中为什么Mysql连接EF时无法选择数据
- 如何把数据库中的ID值与DropDownList的项相关联?
- 如何向DataSet的具体表的具体行的具体列赋值和取值?
- gridview RowDataBound 中删除行
- 讨论一下IRegisteredObject这个接口吧
using System;
using System.Runtime.InteropServices;namespace Demo
{
public class Ssl
{
[DllImport("kernel32.dll")]
internal static extern IntPtr LoadLibrary(String dllname); [DllImport("kernel32.dll")]
internal static extern IntPtr GetProcAddress(IntPtr hModule, String procname); internal delegate bool SslEmptyCacheHelper(IntPtr targetName, int flags); /// <summary>
/// UNICODE版
/// </summary>
/// <returns></returns>
public bool SslEmptyCacheW()
{
IntPtr schannel = LoadLibrary("Schannel.dll");
IntPtr procaddr = GetProcAddress(schannel, "SslEmptyCacheW");
SslEmptyCacheHelper helper = (SslEmptyCacheHelper)Marshal.GetDelegateForFunctionPointer(procaddr, typeof(SslEmptyCacheHelper));
return helper(IntPtr.Zero, 0);
} /// <summary>
/// ANSI版
/// </summary>
/// <returns></returns>
public bool SslEmptyCacheA()
{
IntPtr schannel = LoadLibrary("Schannel.dll");
IntPtr procaddr = GetProcAddress(schannel, "SslEmptyCacheA");
SslEmptyCacheHelper helper = (SslEmptyCacheHelper)Marshal.GetDelegateForFunctionPointer(procaddr, typeof(SslEmptyCacheHelper));
return helper(IntPtr.Zero, 0);
}
}}