Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extracting text from request.querystring that contains ampersand

Status
Not open for further replies.

JulesBos

Programmer
Sep 6, 2006
68
US
I originally posted this:


and have discovered that my problem is not my SQL, the problem is that I am trying to extract a string from my page's querystring that contains an ampersand, and everything after the ampersand is ignored. I have encoded the query string as follows:

Dim quoteResponseString As String = _
"Quotes/SearchResultsQuotes.aspx?QuoteID=" + CStr(QuoteID) + "&QuoteNo=" + QuoteNo + _
"&PN=" + QuotePN + "&RaiserID=" + QuoteRaiserID + "&RaiserName=" + QuoteRaiser + _
"&CustID=" + CStr(QuoteCustomerID) + "&CustName=" + QuoteCustomerName + _
"&Lifecycle=" + QuoteLifecycle + "&Breakdown=" + QuoteBreakdown + _
"&All=" + CStr(QuotesAll) + "&DateFrom=" + SelectedFromDate + _
"&DateTo=" + SelectedToDate
Server.UrlEncode(quoteResponseString)
Response.Redirect(quoteResponseString)

The query string looks like this:


When I try and extract Breakdown I get "A" not "A&W".

How on earth do I resolve this one?

Potentially CustName, Lifecycle, or Breakdown could contain ampersands and I can't control that.

Thanks

Julia
 
You can use the Server.URLEncode method on any item in the querystring that can contain an ampersand.

Do it on ONLY the querystring item:

Code:
"&Breakdown=" + Server.URLEncode(QuoteBreakdown) +


I tested this and it worked for me.






[monkey][snake] <.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top