Asp.Net and XML

Discussion in 'ASP .Net' started by Alexander, Jan 14, 2010.

  1. Alexander

    Alexander Guest

    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
    Alexander, Jan 14, 2010
    #1
    1. Advertising

  2. Alexander

    Alexander Guest

    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.


    >
    >> From ASP to the other application all work fine.

    >
    > The other application...?
    >
    >> 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>".

    >
    > 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, Jan 14, 2010
    #2
    1. Advertising

  3. Alexander wrote:

    > 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>

    "


    --

    Martin Honnen --- MVP XML
    http://msmvps.com/blogs/martin_honnen/
    Martin Honnen, Jan 14, 2010
    #3
  4. Alexander

    Alexander Guest


    > 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
    Alexander, Jan 14, 2010
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?VGltOjouLg==?=

    ASP and ASP.NET with XML and XSL

    =?Utf-8?B?VGltOjouLg==?=, May 19, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    289
    =?Utf-8?B?VGltOjouLg==?=
    May 19, 2004
  2. Bomb Diggy
    Replies:
    0
    Views:
    431
    Bomb Diggy
    Jul 28, 2004
  3. Replies:
    0
    Views:
    381
  4. Matt
    Replies:
    3
    Views:
    325
    Bob Barrows [MVP]
    Apr 23, 2004
  5. Erik Wasser
    Replies:
    5
    Views:
    429
    Peter J. Holzer
    Mar 5, 2006
Loading...

Share This Page