Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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);
    }
  #2 (permalink)  
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
  #3 (permalink)  
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 = '&';
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 11:12 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.