1.vb.net加密解密方法

Private Function getLicenseDate() As String
Dim b() As Byte
Dim path As String = Server.MapPath(Context.Request.ApplicationPath) & "License\"
Try
If Not System.IO.Directory.Exists(path) Then
System.IO.Directory.CreateDirectory(path)
End If
Catch ex As IO.IOException
Page.ClientScript.RegisterStartupScript(Me.GetType(), "Alert", "<script>alert('对不起,你可能没有创建文件夹的权限')</script>")
Exit Function
End Try
Dim output As String
Dim filePath As String = path & "License.dat"
If File.Exists(filePath) Then
Try
Dim fs As New FileStream(filePath, FileMode.Open)
Dim sr As New StreamReader(fs)
output = sr.ReadToEnd().ToString()
sr.Close()
fs.Close()
'output = Convert.ToBase64String(System.Text.Encoding.Default.GetBytes(filePath))
Catch ex As Exception
Page.ClientScript.RegisterStartupScript(Me.GetType(), "Alert", "<script>alert('读取LIENCE文件异常!请取消勾选License文件夹下的License.dat的只读属性!')</script>")
End Try
Else
Exit Function
End If
Try
b = Convert.FromBase64String(output)
Catch ex As Exception
Page.ClientScript.RegisterStartupScript(Me.GetType(), "Alert", "<script>alert('对不起,,发生错误')</script>")
End Try
Try
output = System.Text.Encoding.GetEncoding(-).GetString(b)
Dim startIndex As Integer = output.IndexOf("<ValidityDate>") + "<ValidityDate>".Length
Dim endIndex As Integer = output.IndexOf("</ValidityDate>")
Dim index As Integer = endIndex - startIndex
If startIndex > And endIndex > And index > Then
output = output.Substring(startIndex, index)
Else
output = "-1"
End If
Catch ex As Exception
Page.ClientScript.RegisterStartupScript(Me.GetType(), "Alert", "<script>alert('获取License信息发生异常')</script>")
output = ""
End Try
Return output End Function

2. viewstate 作用域是本页面

vb.net加密解密方法的更多相关文章

  1. ASP.NET常用加密解密方法

    ASP.NET常用加密解密方法 一.MD5加密解密 1.加密 C# 代码           public static string ToMd5(string clearString)        ...

  2. ios常见加密解密方法

    在其他平台中经常会计算MD5值,在iOS平台中也提供了该方法,首先需要导入头文件 #import <CommonCrypto/CommonDigest.h> 方法CC_MD5可以获取MD5 ...

  3. C#/IOS/Android通用加密解密方法

    原文:C#/IOS/Android通用加密解密方法 公司在做移动端ios/android,服务器提供接口使用的.net,用到加密解密这一块,也在网上找了一些方法,有些是.net加密了android解密 ...

  4. 2019-2-20C#开发中常用加密解密方法解析

    C#开发中常用加密解密方法解析 一.MD5加密算法 我想这是大家都常听过的算法,可能也用的比较多.那么什么是MD5算法呢?MD5全称是 message-digest algorithm 5[|ˈmes ...

  5. Java实现一个简单的加密解密方法

    Crypto是Java语言写的一个简单的加密解密方法. 使用方法: 加密方法 String cipherte=Enande.encrypt(content, pass): 解密方法 Enande.de ...

  6. C#开发中常用的加密解密方法

    转载自:https://www.cnblogs.com/bj981/p/11203711.html C#开发中常用的加密解密方法 相信很多人在开发过程中经常会遇到需要对一些重要的信息进行加密处理,今天 ...

  7. PHP加密解密方法

    加密解密方法 //字符串解密加密 function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) { $ckey_l ...

  8. Javascript实现base64的加密解密方法

    1 function Base64() { 2 // private property 3 _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijkl ...

  9. ASP程序加密/解密方法大揭密

      如今,用ASP技术构建的网站随处可见.由于ASP脚本是在服务器上解释执行的(无法编译),因此你辛苦开发出来的ASP代码,很容易被人拷去任意修改,如何保护ASP源代码呢?这是每个ASP站长都会遇到的 ...

随机推荐

  1. 动画_ _ Android应用开发之所有动画使用详解

    转载: http://blog.csdn.net/yanbober/article/details/46481171 题外话:有段时间没有更新博客了,这篇文章也是之前写了一半一直放在草稿箱,今天抽空把 ...

  2. RPM方式安装MySQL5.6和windows下安装mysql解压版

    下载地址: http://cdn.MySQL.com/archives/mysql-5.6/MySQL-server-5.6.13-1.el6.x86_64.rpmhttp://cdn.mysql.c ...

  3. android studio新项目时提示:Plugin is too old, please update to a more recent version

    今天想写一个程序来测试一下android studo代码,但是创建好项目后,提示: Error:(1, 0) Plugin is too old, please update to a more re ...

  4. 28. Triangle && Pascal's Triangle && Pascal's Triangle II

    Triangle Given a triangle, find the minimum path sum from top to bottom. Each step you may move to a ...

  5. 41. Unique Binary Search Trees && Unique Binary Search Trees II

    Unique Binary Search Trees Given n, how many structurally unique BST's (binary search trees) that st ...

  6. 验证码I

    package com.ah.testjava.validatecode; import java.awt.Color; import java.awt.Font; import java.awt.G ...

  7. C#GridViewExport帮助类,美化导出

    1.将整GridView的数据导出到Excel中关增加一个效果线做美化 最新的GridViewExport操作类 using System.Data; using System.Web; using ...

  8. 关于ILDASM.EXE的知识整理

    因为现在用的VS2010,发现,这个工具自己就带着ILDASM.EXE这个反编译工具 具体的查找方式为: C:\Program Files\Microsoft SDKS\Windows\V7.0\bi ...

  9. nohup输入密码后继续后台运行

    Linux/Unix 是真正的多用户,多任务.Linux 提供了 fg 和bg 命令,让你轻松调度正在运行的任务. 假设你发现前台运行的一个程序需要很长的时间,但是需要干其他的事情,你就可以用 Ctr ...

  10. [电脑常见问题] win8 ie浏览器打不开

    我安装的是win8专业版,正版的已经激活了,突然IE浏览器就打不开了,在桌面里面点IE没反应,在Metro界面点IE就回到开始界面 解决办法: 1.Win+R呼出运行窗口,键入Regedit,回车,打 ...