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 October 2nd, 2009, 12:59 PM
Registered User
 
Join Date: Oct 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch4 Encrypt and Decrypting the url

this is showing error.

Code:
public static NameValueCollection DecryptQueryString(string queryString)
    {
        if (queryString.Length != 0)
        {
            //Decode the string
            string decodedQueryString = HttpUtility.UrlDecode(queryString);
            //Decrypt the string
            string QUERY_STRING_DELIMITER;
            string decryptedQueryString = StringHelpers.Decrypt(decodedQueryString);
            //Now split the string based on each parameter
           string[] actionQueryString = decryptedQueryString.Split(new char[] {QUERY_STRING_DELIMITER}); //(QUERY_STRING_DELIMITER);
            NameValueCollection newQueryString = new NameValueCollection();
            //loop around for each name value pair.
            for (int index = 0; index < actionQueryString.Length; index++)
            {
                string[] queryStringItem = actionQueryString[index].Split(new char[] { '=' });
                newQueryString.Add(queryStringItem[0], queryStringItem[1]);
            }
            return newQueryString;
        }
        else
        {
            //No query string was passed in.
            return null;
        }
    }
    public static string EncryptQueryString(NameValueCollection queryString)
    {
        //create a string for each value in the query string passed in.
        string tempQueryString = "";
        for (int index = 0; index < queryString.Count; index++)
        {
            tempQueryString += queryString.GetKey(index) + "=" + queryString[index];
            if (index != queryString.Count - 1)
            {
                tempQueryString += QUERY_STRING_DELIMITER;
            }
        }
        return EncryptQueryString(tempQueryString);
    }
 
Old October 2nd, 2009, 04:36 PM
Authorized User
 
Join Date: Apr 2009
Posts: 41
Thanks: 1
Thanked 2 Times in 2 Posts
Default

What error are you getting?

Chances are that you don't have anything defined for QUERY_STRING_DELIMITER. I don't have my book with me, but I'm pretty sure it was a constant set somewhere. Double-check the book or look at the dowloadable code.

Tim
 
Old October 13th, 2009, 11:02 AM
Registered User
 
Join Date: Oct 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Add constante

private const char QUERY_STRING_DELIMITER = '&';





Similar Threads
Thread Thread Starter Forum Replies Last Post
Decrypting pgp files with vbscript tonyromero99 VBScript 4 June 4th, 2008 04:09 AM
DECRYPTING Data? Thagi ASP.NET 1.x and 2.0 Application Design 1 March 28th, 2006 05:46 PM
How to implement encrypt URL qazi_nomi Beginning PHP 0 August 19th, 2005 04:23 AM
problem decrypting bluelaser General .NET 0 October 10th, 2004 10:18 AM
Encrypting and Decrypting chipset VB How-To 0 July 27th, 2004 07:36 AM





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