I am opening a jquery dialog with the following steps.
var vFrm = document.getElementById("addressValidationFrame");
vFrm.src = "../Address%20Validation.aspx?address=" + addrVal + "&city="
+ cityVal + "&state=" + stateVal + "&zip=" + zipVal
+ "&type=" + type;
$("#dialogAV").dialog({
modal: true, title: vFrmName, width: 600, height: 400, resizable: false,
close: function (event, ui) {
vFrm.src = "";
$(this).dialog("destroy");
__doPostBack();
}
});
In the Address%20Validation.Page_Load()
I Request the posted values:
String validationType = Request.QueryString["type"].ToString();
String addrParam = Request.QueryString["address"].ToString();
Address Validation would then go on to use the FedEx address validation service to validate the submitted address (city,state,zip not shown here).
All was working without a problem until I ran into a submitted "address" that contained a #(hash) character. The presence of the # character seems perfectly normal as part of an address (for room/apt/suite numbers), so I expect to run into these frequently.
With a #, an exception is thrown when Request'ing the first parameter "type". I tried substituting the html code for # => #:
...?address=" + addVal.replace(/#/g,"#") + ...
...but to no avail. I still get an object null reference exception on the first Request.QueryString call. To keep developing other parts of my process, I settled on this:
...?address=" + addVal.replace(/#/g,"Suite ") + ...
..which I am not particularly proud of. I am open to suggestions.