zoukankan      html  css  js  c++  java
  • 【ASP】简单Url编码和Url解码实例

    描述:在数据传输或读取时,有些敏感数据不宜显示传输,特别涉及机密或财务信息,因此使用编码技术尤为重要。

    简单实例:

    URL编码代码:

    protected void Button1_Click(object sender, EventArgs e)
            {
                if (TextBox1.Text == null)
                {
                    Response.Write("<script>alert('文本不存在,无法编码')</script>");
                }
                else
                {
                    string str = TextBox1.Text;
                    string UrlEncode = Server.UrlEncode(str);
                    Label1.Text = "编码后的数据" + UrlEncode;
                }

            }

    Url解码代码:

            protected void Button2_Click(object sender, EventArgs e)
            {
                if (TextBox1.Text == null)
                {
                    Response.Write("<script>alert('文本不存在,无法编码')</script>");
                }
                else
                {
                    string str = TextBox1.Text;
                    string UrlDecode = Server.UrlDecode(str);
                    Label2.Text = "编码后的数据" + UrlDecode;
                }
            }

    扩展:加密类别的其他方式

  • 相关阅读:
    JavaScript根据CSS的Media Queries来判断浏览设备的方法
    JavaScript API 设计原则
    高性能 CSS3 动画
    CSS代码实例:用CSS代码写出的各种形状图形
    frontpage 2010.2003绿色版
    Web前端年后跳槽必看的各种面试题
    [ksm][数学] Jzoj P5810 简单的玄学
    [分治] Jzoj P5807 简单的区间
    [dfs][bfs] Jzoj P5806 简单的操作
    [dp] Jzoj P5804 简单的序列
  • 原文地址:https://www.cnblogs.com/baiboy/p/UrlEncode.html
Copyright © 2011-2022 走看看