c# - Request.Params to String gives incomplete data -
don't know if character encoding issue
i made post request asp.net page, send xml, in order value variable made this
string selectionxml = httputility.urldecode(request.params["selection"]);
this example of xml
<?xml version="1.0" encoding="utf-8"?> <featureset> <layer id="0adcf012"> <class id="mytable"> <id>aaaaaaamvea=</id> <id>aaaaaac+5ea=</id> </class> </layer> </featureset>
the problem is, when perform above sentence xml
<?xml version="1.0" encoding="utf-8"?> <featureset> <layer id="0adcf012"> <class id="mytable"> <id>aaaaaaamvea=</id> <id>aaaaaac 5ea=</id> </class> </layer> </featureset>
i.e. second id tag (aaaaaac 5ea=) appears without plus sign (+) unlike original xml (aaaaaac+5ea=)
how can fix issue?
edit: add more code, asp.net page (using mapguide library)
<%@ page language="c#" debug="true" validaterequest="false"%> <%@ import namespace="system" %> <%@ import namespace="system.collections.specialized" %> <%@ import namespace="system.io" %> <%@ import namespace="osgeo.mapguide" %> <!-- #include file="common.aspx" --> <% response.charset = "utf-8"; string sessionid; string mapname; string locale; int target=0; int popup=0; string selectedlayer; mgselection selection = null; sessionid = request.params["session"]; mapname = request.params["mapname"]; locale = request.params["locale"]; target = int.parse(request.params["tgt"]); popup = int.parse(request.params["popup"]); selectedlayer = request.params["layertarget"]; bool todos = false; try { // initialize web extensions , connect server using // web extensions session identifier stored in php session state. //mapguideapi.mginitializewebtier (constants.webconfigpath); initializewebtier(); mguserinformation userinfo = new mguserinformation(sessionid); mgsiteconnection siteconnection = new mgsiteconnection(); siteconnection.open(userinfo); mgmap map = new mgmap(siteconnection); map.open(mapname); // ---------------------------------------------------------- // use following code ajax or dwf viewers // requires passing selection data via http post mgreadonlylayercollection layers = null; **string selectionxml = httputility.urldecode(request.params["selection"]);** if (selectionxml!= null) { selection = new mgselection(map, selectionxml); layers = selection.getlayers(); } ..........
how can fix issue?
why using httputility.urldecode
? it's xml, not url! long you're using post request
don't need httputility.urldecode
.
Comments
Post a Comment