HttpServerUtility.UrlTokenDe code似乎只返回null [英] HttpServerUtility.UrlTokenDecode only seems to return null

查看:122
本文介绍了HttpServerUtility.UrlTokenDe code似乎只返回null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎有与 HttpServerUtility.UrlTokenDe code(字符串)问题,因为它是不断地返回null,导致程序崩溃。

I seem to be having an issue with the HttpServerUtility.UrlTokenDecode(string), as it is constantly returning null, causing the program to crash.

从我所收集的,它是的base64字节数组此方法将字符串转换。不幸的是,code的原开发商是不再与我们,似乎没有多少人在我的办公室熟悉code。

From what I have gathered, this method will convert a string to it's base64 Byte-Array. Unfortunately, the original developer of the code is no longer with us, and it seems not many people in my office are familiar with the code.

public string DecodeUrlData(string urlData)
{
    string lsReturnVal = string.Empty;
    byte[] decodedrtfBytes = HttpServerUtility.UrlTokenDecode(urlData);

    lsReturnVal = System.Text.ASCIIEncoding.ASCII.GetString(decodedrtfBytes);
    return lsReturnVal;
}

这是已经写入了code和 urlData 具有以下值:

That is the code that has been written, and urlData has the following value:

urlData = "pdfSignature template testing."

(还应该知道, urlData 可以具有字符串的值,或rtfformatted字符串)

(It should also be known that urlData may have either a "string" value, or a rtfformatted string)

但在执行 HttpServerUtility.UrlTokenDe code(urlData)行什么时候结束了发生的事情是,字节数组最终被空(导致异常以下线)。

But what ends up happening is when the HttpServerUtility.UrlTokenDecode(urlData) line is executed, the byte array ends up being null (causing an exception in the following line).

有另一种方式将字符串转换为Base64,将工作,或者为什么它继续生产一个空值?

Is there another way to convert the string to base64 that would work, or why does it keep producing a null value?

推荐答案

据该的 HttpServerUtility.UrlTokenDe code 文档,在输入参数应为地址标记<通过/ STRONG> previously EN codeD UrlTokenEn code

报价:

该UrlTokenDe code方法会将
  URL字符串令牌,该令牌EN codeS二进制
  数据为基础64位数,其
  相当于字节数组重新presentation。
  使用UrlTokenDe code方法
  德code标记的URL发送
  和连接$ C $使用cd
  UrlTokenEn code。

The UrlTokenDecode method converts a URL string token, which encodes binary data as base 64 digits, to its equivalent byte array representation. Use the UrlTokenDecode method to decode tokens transmitted on the URL and encoded by using the UrlTokenEncode.

这篇关于HttpServerUtility.UrlTokenDe code似乎只返回null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆