Passing special characters in query string

Posted on 2005-04-21
Last Modified: 2010-04-07

I occasionally pass error messages to an page via the query string via a vb .net program.

Sometimes the error messages dont get through due to certain characters in the query string.

How could i pass these special characters across without messing up the query string (eg an error message containing an '&')


If anyone has a better way to pass data to an ASP .net page please tell.

Question by:adam_pedley
    1 Comment
    LVL 3

    Accepted Solution

    Try encoding and decoding the querystring before sending.

    Like Server.HtmlEncode(message)... then Server.HtmlDecode(message).

    Remember don't encode and decode the ENTIRE querystring as it will rewrite your &'s (among other things) thus render your querystring code useless.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now