ASP.NET加密Cookie数据的方法
'SetCookie (只针对密钥和Cookie数据)
Public Shared Sub SetCookie(ByVal key As String, ByVal value As String)
'编码部分
key = HttpContext.Current.Server.UrlEncode(key)
value = HttpContext.Current.Server.UrlEncode(value)
Dim cookie As HttpCookie
cookie = New HttpCookie(key, value)
SetCookie(cookie)
End Sub
'SetCookie(增加了Cookie数据的有效期参数)
Public Shared Sub SetCookie(ByVal key As String, _
ByVal value As String, ByVal expires As Date)
'编码部分
key = HttpContext.Current.Server.UrlEncode(key)
value = HttpContext.Current.Server.UrlEncode(value)
Dim cookie As HttpCookie
cookie = New HttpCookie(key, value)
cookie.Expires = expires
SetCookie(cookie)
End Sub
'SetCookie (只针对HttpCookie)
Public Shared Sub SetCookie(ByVal cookie As HttpCookie)
HttpContext.Current.Response.Cookies.Set(cookie)
End Sub
'获取COOKIE *****************************************************
- 相关内容
- 最近更新
- ·索尼爱立信K660上市打造3G低价手..
- ·2008年qq空间个性签名
- ·qq空间黑色皮肤代码
- ·学好Excel函数应提高Excel技术水..
- ·15招加快电脑启动速度
- ·有些木马删不了怎么办,要不就删..
- ·摄像头没驱动用不了如何安装
- ·声卡驱动无法安装有个黄色的感叹..
- ·液晶显示器黑屏处理办法
- ·08年3月份5000元电脑配置
添加到百度搜藏