Asp.Net and XML

  • Thread starter Thread starter Alexander
  • Start date Start date
A

Alexander

Hi,
I'm writing an application that use an Asp.Net Application to
send/recive data from a database (MS SQL Server).
To send/recive data i use XML. From ASP to the other application all
work fine.
But when I try to send XML data as a parameter from the other
application to the Asp.Net application I get an exception.
Asp.Net dosen't acept charters like "<" or ">" with same text inside:
"<text>".
Dose anyone know how i can send XML code like parameter to ASP?

Thaks

Alexander
 
thanks for the reply,


Is this a homework exercise? If not, it sounds very much like you are
making things much more difficult for yourself than they need to be...


No is not an homework exercice.

The other application...?


Can you please explain in more detail precisely what you are trying to
do? A code example would be appreciated too...

Ok I explain better:

My first application is a clinet-side Adobe Flex application. This
application must read and write data on a MS SQL Server. To do this I
use HTTP Post method and an Asp.Net application:

this is the code that i use in the asp application to read the XML
parameter:

....
private void Page_Load(object sender, EventArgs e)
{
...
switch (Request["Call"])
{
...

case "SaveData":
MyFunction(Request["XML"]);
break;

...
}
....

But when i execute the comand to send XML data in the flex application i
obtain an error. The Flex code is correct (I test the same code with a
PHP/MySql application that work fine).

So the problem is that Asp.Net not acept string like "<sometext>" as
paramters.

Wath can i do?

Thanks
 
Alexander said:
So the problem is that Asp.Net not acept string like "<sometext>" as
paramters.

What exactly happens? Do you get a HttpRequestValidationException
exception? In that case the documentation
http://msdn.microsoft.com/en-us/library/system.web.httprequestvalidationexception.aspx
suggests you have some options to avoid that:

"Request validation detects potentially malicious client input and
throws this exception to abort processing of the request. A request
abort can indicate an attempt to compromise the security of your
application, such as a cross-site scripting attack. It is strongly
recommended that your application explicitly check all input regarding
request aborts. However, you can disable request validation by setting
the validateRequest attribute in the @ Page directive to false, as shown
in the following example:

<%@ Page validateRequest="false" %>

To disable request validation for your application, you must modify or
create a Web.config file for your application and set the
validateRequest attribute of the pages section to false, as shown in the
following example:

<configuration>
<system.web>
<pages validateRequest="false" />
</system.web>
</configuration>

"
 
To disable request validation for your application, you must modify or
create a Web.config file for your application and set the
validateRequest attribute of the pages section to false, as shown in the
following example:

<configuration>
<system.web>
<pages validateRequest="false" />
</system.web>
</configuration>

"

Thanks, Thanks a lot!!! I had this setting in mio Web.config file and
all work perfectly.
Thanks again!

Alenxader
 
Back
Top