在经典的asp中将base64字符串转换为字节数组

时间:2016-12-15 06:53:58

标签: vbscript asp-classic base64

我想在经典asp中将base 64字符串转换为字节数组。将base 64字符串解码为字节数组的代码如下:

Function Base64Decode(ByVal vCode)
        Dim oXML, oNode
        Set oXML = CreateObject("Msxml2.DOMDocument.3.0")
        Set oNode = oXML.CreateElement("base64")
        oNode.dataType = "bin.base64"
        oNode.text = vCode
        Base64Decode = oNode.nodeTypedValue
        Set oNode = Nothing
        Set oXML = Nothing
    End Function  

当我用一个小字符串调用此函数时,此函数正常工作。但是当我用大字符串调用此函数时,如下所示:

Dim simpleString
 simpleString = "MjY1MDEgICAgICAgICAgIAUNAwMAVBIZPXd3d3d3d3d3d3d3d3d3d3d3d3d3d3cHADk6Ojo6 Ojh3d3d3d3d3dw8KATsAOzo5OTg4d3d3d3d3Dg0IAgEAOzo4Nzc4OHd3d3cODgwIBQQBOjk5 ODY2Nzd3d3cNDQwKCAcDADs6OTc1NjZ3d3cNDQwKCQcEAgA7Ozs4NTY5d3cODQ0KCQcFAgA7 AAA7OTg7d3cPDQwKCQcGAwEAAAAAADs6d3cODAsKCAcGBQIAAAABAgEAd3cODQwJCAcHBgQC AQECAQAAd3cNDQwJCQkIBgQCAQEBADs7d3cPDQ0MCQcFBQQCAAABADs6d3cQDQ0MCQcGBQQC ADs7Ozo4d3cODQsLCgkIBwUDADs5Ojo2d3cLDAwMCwoJCAYDADs6Ojo2d3cMCwwNDQwKCggF AgA7Ozo3d3cNDg4ODg4NCwkHBQI7Ojg3d3cODg4ODg4ODAoIBgM7OTc3d3cODw4NDg4ODg0K BwQ5NzQyd3cODw8QEBAQEA8MCAQ6NTIwd3cODxITFBUUEhIRDQk7NDIwd3cPERYXGBoZFxcX FRMxMjEtd3cRFBkbHB4eHh0dHR8nLS8ud3d3d3d3d3d3d3d3d3d3d3d3d0dcHUk0cmEXfDNP gB4PGR4RGQxpIhFiCUlobhpURScuTmh4gl4iJXSENBxtgDeFcnM/YGt8eW1lOCGGVywAA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3d3d3d3d3AQI3MjIx Li93d3d3d3d3d3cBOzo1MzIwLy0rd3d3d3d3dwQDADg1NDMxLy0rd3d3d3d3dwQCOzc1NDMx MC4sK3d3d3d3dwQBOjg2NDIyMC4sKnd3d3d3CQUCOzk2NDIyMC4tK3d3d3d3CggEADk2MzIy MC8vLCl3d3d3CwkGATg1MjEwMC8uKyh3d3d3DgsIAjk0MjAuLS0sKih3d3d3EQ8KAzgzMC4t KystLix3d3d3FBMPBTcxLi0sKystLit3d3d3GBcUCjcwLSsrLCwrKid3d3d3d3d3d3d3d3d3 d3d3d3d3d1FLWCNfSB5vc3RWdXcmK2BeIlVBcwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAABhY255f4KEhZKYnJ+lsba7dYWHiIoAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgwOCwICFxAPDwIQEBYJ Dw8MDg0QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="
  Base64Decode(simpleString)

然后我收到了这个错误:

  

500 - 内部服务器错误。
  您正在查找的资源存在问题,无法显示。

为什么我收到此错误?如何删除此错误?请帮我删除此错误。

1 个答案:

答案 0 :(得分:-2)

请尝试以下代码。它可以帮助您将base64string转换为字节数组。

@IBAction func handleVideoChageSlider(_ sender: UISlider)  {
    print(sender.value)

    let cell: FeedCell = tableView.cellForRowAtIndexPath(NSIndexPath(forRow: sender.tag, inSection: 0)) as! FeedCell

    cell.videolabl.text="change name"
}