Wrox Programmer Forums
|
BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio
This is the forum to discuss the Wrox book ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solution by Vincent Varallo; ISBN: 9780470396865
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 31st, 2010, 05:53 AM
Registered User
 
Join Date: Nov 2009
Posts: 6
Thanks: 2
Thanked 0 Times in 0 Posts
Default Decrypt querystring error

Hello,
I am trying to pass a parameter in the querystring using this link:
"javascript:window.open('ServiceProvider.aspx" & EncryptQueryString("id=0") & "','br','width=550,height=600');"

But when I click on the link, I get the error : Invalid Length for a Base-64 char array in the StringHelpers.vb class in the line where the bytIn array is defined:

Public Shared Function Decrypt(ByVal encryptedString As String) As String
If encryptedString.Trim().Length <> 0 Then
' Convert from Base64 to binary

Dim bytIn As Byte() = Convert.FromBase64String(encryptedString)

' Create a MemoryStream
Dim ms As New MemoryStream(bytIn, 0, bytIn.Length)

' Create a CryptoStream that decrypts the data
Dim cs As New CryptoStream(ms, _cryptoProvider.CreateDecryptor(Key, IV), CryptoStreamMode.Read)

' Read the Crypto Stream
Dim sr As New StreamReader(cs)

Return sr.ReadToEnd()
Else
Return ""
End If
End Function

Why would that be?
The decription method works fine when I use it in the sample application, but whenever I try to add the encrypted querystiring in a javascript window.open method, it fails!

Thanks
Emmanouil Filippou





Similar Threads
Thread Thread Starter Forum Replies Last Post
Decrypt nmm39 ASP.NET 3.5 Basics 8 December 2nd, 2009 11:59 AM
FormsAuthentication.Decrypt problem samara General .NET 0 December 26th, 2007 06:10 AM
[HOW TO] Decode / Decrypt Sha1 ??? oscarestany PHP How-To 1 August 6th, 2007 05:49 PM
encrypt and decrypt fuadlutfi85 Pro JSP 0 July 5th, 2007 09:00 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.